add_panel("panel_header", array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Header', 'textdomain' ), 'description' => __( 'Color, Nav, Logo.', 'textdomain' ), ) ); /* * * HEADER */ $wp_customize->add_section('section_header', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( "Header", 'textdomain' ), 'description' => '', 'panel' => 'panel_header', ) ); $wp_customize->add_setting( 'header',array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'header', array( 'label' => __( 'Upload your header', 'm1' ), 'section' => 'section_header', 'settings' => 'header', ) ) ); /************* logo ****************/ $wp_customize->add_section('section_logo', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( "Logo", 'textdomain' ), 'description' => '', 'panel' => 'panel_header', ) ); $wp_customize->add_setting( 'logo',array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'logo', array( 'label' => __( 'Upload Logo (replaces text)', 'm1' ), 'section' => 'section_logo', 'settings' => 'logo', ) ) ); $wp_customize->add_setting( 'logo_sm',array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'logo_sm', array( 'label' => __( 'Upload a smaller logo', 'm1' ), 'section' => 'section_logo', 'settings' => 'logo_sm', ) ) ); /************ navigation color ****************/ $wp_customize->add_section('section_nav', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( "Navigation", 'textdomain' ), 'description' => '', 'panel' => 'panel_header', ) ); $wp_customize->add_setting( 'color', array( 'default' => '#000000', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'color', array( 'label' => 'Navigation color', 'section' => 'section_nav', 'settings' => 'color', ) ) ); /********** navigation text color **********/ $wp_customize->add_setting( 'text_color', array( 'default' => '#fff', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'text_color', array( 'label' => 'Text color', 'section' => 'section_nav', 'settings' => 'text_color', ) ) ); /* * This will let the user choose from bootstrap */ $wp_customize->add_setting( 'nav_style', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'nav_style', array( 'label' => 'Navigation style', 'section' => 'section_nav', 'type' => 'select', 'choices' => array( "default"=>"Default", "static"=>"Static", "fixed"=>"Fixed", ) ) ); return $wp_customize; } function theme_customizer_general_settings($wp_customize){ $wp_customize->add_panel("panel_general_settings", array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Settings', 'textdomain' ), ) ); /* * SEO keywords and Description * */ $wp_customize->add_section( '_SEO_', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( "SEO", 'textdomain' ), 'description' => '', 'panel'=>'panel_general_settings' )); /********** seo keywords **********************/ $wp_customize->add_setting( 'keywords', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'keywords', array( 'label' => 'Keywords', 'description'=>'Global keywords for home page and other pages without description', 'section' => '_SEO_', 'type' => 'text', )); /********** seo description *******************/ $wp_customize->add_setting( 'description', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'description', array( 'label' => 'Description', 'description'=>'Global description for home page and other pages without description', 'section' => '_SEO_', 'type' => 'textarea', )); $wp_customize->add_setting( 'seo', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' )); $wp_customize->add_control( 'seo', array( 'label' => 'Turn on SEO', 'description'=>'This function allow you to add keywords from post or page tags, also description from both', 'section' => '_SEO_', 'type' => 'checkbox', )); $wp_customize->add_setting( 'metatag_google', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' )); $wp_customize->add_control( 'metatag_google', array( 'label' => 'Google site verification', 'section' => '_SEO_', 'type' => 'text', )); $wp_customize->add_setting( 'metatag_bing', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' )); $wp_customize->add_control( 'metatag_bing', array( 'label' => 'Bing site verification', 'section' => '_SEO_', 'type' => 'text', )); $wp_customize->add_setting( 'google_analytic', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' )); $wp_customize->add_control( 'google_analytic', array( 'label' => 'Google analytic', 'description'=>'Please add just the ID example UA-00090000-7', 'section' => '_SEO_', 'type' => 'text', )); /* * hide company profile, this option will hide profile * from footer or header where the company information * is located. */ $wp_customize->add_section('section_general_settings', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( "Company profile", 'textdomain' ), 'description' => '', 'panel'=>'panel_general_settings' ) ); $wp_customize->add_setting( 'company_profile', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'company_profile', array( 'label' => 'Hide company profile', 'section' => 'section_general_settings', 'type' => 'checkbox', ) ); /********** company name **********************/ $wp_customize->add_setting( 'company_name', array( 'default' => 'my company name', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'company_name', array( 'label' => 'Company name', 'section' => 'section_general_settings', 'type' => 'text', ) ); /******** company full address *************/ $wp_customize->add_setting( 'company_address', array( 'default' => 'my company full address', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'company_address', array( 'label' => 'Company address', 'section' => 'section_general_settings', 'type' => 'text', ) ); /********* company phone number *****************/ $wp_customize->add_setting( 'company_phone', array( 'default' => '888-2000-3231', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'company_phone', array( 'label' => 'Company phone number', 'section' => 'section_general_settings', 'type' => 'text', ) ); /********* company fax number *****************/ $wp_customize->add_setting( 'company_fax', array( 'default' => '888-2000-3232', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'company_fax', array( 'label' => 'Company fax number', 'section' => 'section_general_settings', 'type' => 'text', ) ); /* * SOCIALMEDIA * this way is more organizer */ $wp_customize->add_section('socialmedia', array( 'priority' => 18, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( "Social media", 'textdomain' ), 'description' => '', 'panel'=>'panel_general_settings' ) ); $social = theme_socialmedia_sites();; foreach ($social as $key => $value){ $wp_customize->add_setting( $key,array( 'default' => '', 'sanitize_callback' => 'esc_textarea' )); $wp_customize->add_control($key, array( 'label' => $value, 'section' => 'socialmedia', 'type' => 'text', ) ); } /* * Custom css for the user the edit his website */ $wp_customize->add_section('section_custom_css', array( 'priority' => 18, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( "Custom css", 'textdomain' ), 'description' => '', 'panel'=>'panel_general_settings' ) ); $wp_customize->add_setting( 'custom_css', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' )); $wp_customize->add_control( 'custom_css', array( 'label' => 'Custom css', 'section' => 'section_custom_css', 'type' => 'textarea', )); return $wp_customize; } function theme_customizer_items($wp_customize,$section_title,$section_suffix,$section_name,$limit){ $panel_id = $section_name; $wp_customize->add_panel($panel_id, array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => $section_title, 'description' => 'You can upload images, set title, add some text or html to use on each item of your '.$section_title, ) ); $i = 1; while ($i <= $limit) { $section_name = $section_suffix.$i; $wp_customize->add_section($section_name, array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => "Edit item ".$i, 'description' => '', 'panel' => $panel_id, ) ); /*********** slider image ******************/ $wp_customize->add_setting( $section_suffix.$i.'_image',array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, $section_suffix.$i.'_image', array( 'label' => __('Image', 'm1' ), 'section' => $section_name, 'settings' => $section_suffix.$i.'_image', ) ) ); /******** slider title *********/ $wp_customize->add_setting( $section_suffix.$i.'_title', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( $section_suffix.$i.'_title', array( 'label' => 'Title', 'section' => $section_name, 'type' => 'text', ) ); /******** slider link *********/ $wp_customize->add_setting( $section_suffix.$i.'_link', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( $section_suffix.$i.'_link', array( 'label' => 'Link', 'section' => $section_name, 'type' => 'text', ) ); /******** slider btn title *********/ $wp_customize->add_setting( $section_suffix.$i.'_btn', array( 'default' => 'READ MORE', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( $section_suffix.$i.'_btn', array( 'label' => 'Button text', 'section' => $section_name, 'type' => 'text', ) ); /******** slider content ********/ $wp_customize->add_setting( $section_suffix.$i.'_text', array( 'default' => '', 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( $section_suffix.$i.'_text', array( 'label' => 'Text content', 'section' => $section_name, 'type' => 'textarea', ) ); $i++; } return $wp_customize; } function theme_customizer_footer($wp_customize){ $wp_customize->add_panel('panel_footer', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Footer',"text-domain"), 'description' => __( 'Edit copyright from footer using HTML', 'textdomain' ), )); /* * Add footer section to use with panel_footer */ $wp_customize->add_section('footer', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Copyright','text-domain'), 'description' => '', 'panel' => 'panel_footer', )); /* * add company copyright to use at footer */ $wp_customize->add_setting( 'company_copyright', array( 'default' => '© Blue House
by Garciacom', 'sanitize_callback' => 'esc_textarea' )); $wp_customize->add_control( 'company_copyright', array( 'label' => 'Copyright html', 'section' => 'footer', 'type' => 'textarea', )); return $wp_customize; } function theme_customizer($wp_customize) { /* * deprecated a lot plugins out they do that. * $wp_customize = theme_customizer_seo($wp_customize); */ $wp_customize = theme_customizer_header($wp_customize); $wp_customize = theme_customizer_footer($wp_customize); $wp_customize = theme_customizer_items($wp_customize,'Slideshow','slider_','_SLIDER_',THEME_SLIDESHOW); $wp_customize = theme_customizer_items($wp_customize,'Services','services_','_SERVICES_',THEME_SERVICES); $wp_customize = theme_customizer_general_settings($wp_customize); } ?>