<?php
//acf option page
if( function_exists('acf_add_options_page') ) {    
    acf_add_options_page(array(
        'page_title'    => 'Theme General Settings',
        'menu_title'    => 'Theme Settings',
        'menu_slug'     => 'theme-general-settings',
        'capability'    => 'edit_posts',
        'redirect'      => false
    ));     
}

//remove ul from menu
function remove_ul ( $menu ){
    return preg_replace( array( '#^<ul[^>]*>#', '#</ul>$#' ), '', $menu );
}
add_filter( 'wp_nav_menu', 'remove_ul' );



//custom editor style
function sw_editor_styles() {
    add_editor_style( 'custom-editor-style.css' );
}
add_action( 'admin_init', 'sw_editor_styles' );


//define content width for the theme
if ( ! isset( $content_width ) )
    $content_width = 1170; 
    function norcalpool_content_width() {
        global $content_width; 
    }
add_action( 'template_redirect', 'norcalpool_content_width' );


//remove meta
remove_action('wp_head', 'wp_generator');


//css and jquery version remove
function vc_remove_wp_ver_css_js( $src ) {
    if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
function remove_cssjs_ver( $src ) {
    if( strpos( $src, '?ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );


// This theme uses wp_nav_menu() in one location.  
register_nav_menus( array('footer_menu' => __( 'Footer Menu', 'sw theme' ), 'header_menu'=> __( 'Header Menu', 'sw theme' )));