private function layout($wp_customize) { $wp_customize->add_section('genesis_layout', array('title' => __('Site Layout', 'genesis'), 'priority' => 150)); $wp_customize->add_setting($this->get_field_name('site_layout'), array('default' => genesis_get_default_layout(), 'type' => 'option')); $wp_customize->add_control('genesis_layout', array('label' => __('Select Default Layout', 'genesis'), 'section' => 'genesis_layout', 'settings' => $this->get_field_name('site_layout'), 'type' => 'select', 'choices' => genesis_get_layouts_for_customizer())); }
/** * Adds the individual sections, settings, and controls to the theme customizer */ function coastal_customizer($wp_customize) { // Remove unused sections $wp_customize->remove_section('colors'); $wp_customize->remove_section('background_image'); $wp_customize->remove_control('display_header_text'); $wp_customize->remove_section('genesis_layout'); $wp_customize->remove_section('static_front_page'); $wp_customize->remove_control('genesis_content_archive_thumbnail'); $wp_customize->remove_control('genesis_image_size'); $wp_customize->remove_control('genesis_image_alignment'); $wp_customize->remove_control('genesis_posts_nav'); $wp_customize->remove_section('genesis_archives'); // Update postMessage on existing settings $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; //-----------------------Landing Header Section -----------------------// // Update description on header image section $wp_customize->get_section('header_image')->title = __('Landing Header'); $wp_customize->get_section('header_image')->priority = 20; $wp_customize->get_control('header_image')->priority = 20; //Homepage header headline text box $wp_customize->add_setting('header-headline-box', array('transport' => 'postMessage', 'sanitize_callback' => 'coastal_sanitize_text')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'header-headline-box', array('label' => __('Headline Text'), 'section' => 'header_image', 'settings' => 'header-headline-box', 'type' => 'text', 'description' => __('Use this field to display a boxed headline in the header section')))); //Homepage header text box $wp_customize->add_setting('header-textbox', array('transport' => 'postMessage', 'sanitize_callback' => 'coastal_sanitize_text')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'header-textbox', array('label' => __('Header Overlay Text'), 'section' => 'header_image', 'settings' => 'header-textbox', 'type' => 'textarea', 'description' => __('Use this field to add any additional overlay content to the header area, like a button or a call to action. Accepts html tags like 〈h1〉〈strong〉〈img〉〈a〉 etc.')))); //Homepage Header Text Color $wp_customize->add_setting('header_txt_color', array('default' => '#333', 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_txt_color', array('label' => __('Homepage Header Text Color'), 'section' => 'header_image', 'settings' => 'header_txt_color'))); //Control fixed background $wp_customize->add_setting('fix_header', array('sanitize_callback' => 'sanitize_checkbox', 'transport' => 'postMessage')); $wp_customize->add_control('fix_header', array('type' => 'checkbox', 'label' => __('Fix header image on scroll'), 'section' => 'header_image')); //Logo upload section $wp_customize->add_setting('logo_upload', array('transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_upload', array('label' => __('Logo Upload'), 'section' => 'title_tagline', 'settings' => 'logo_upload'))); //-----------------------Theme Style Section -----------------------// // Add Theme Styles section $wp_customize->add_section('theme-style', array('title' => __('Theme Colors'), 'description' => __('Note: home page section colors are controlled individually via the page editor.'), 'priority' => 21)); //Border color $wp_customize->add_setting('coastal-border-color', array('default' => '#333333', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'coastal-border-color', array('label' => __('Element Border Color'), 'section' => 'theme-style', 'settings' => 'coastal-border-color'))); //Footer background color $wp_customize->add_setting('footer-background-color', array('default' => '#edf4f4', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'footer-background-color', array('label' => __('Footer Background Color'), 'section' => 'theme-style', 'settings' => 'footer-background-color'))); //Primary background color $wp_customize->add_setting('primary-background-color', array('default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary-background-color', array('label' => __('Primary Background Color'), 'section' => 'theme-style', 'settings' => 'primary-background-color'))); //Secondary background color $wp_customize->add_setting('secondary-background-color', array('default' => '#edf4f4', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'secondary-background-color', array('label' => __('Secondary Background Color'), 'section' => 'theme-style', 'settings' => 'secondary-background-color'))); //Button hover color $wp_customize->add_setting('btn-hover-color', array('default' => '#edf4f4', 'sanitize_callback' => 'sanitize_hex_color')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'btn-hover-color', array('label' => __('Button Hover Color'), 'section' => 'theme-style', 'settings' => 'btn-hover-color'))); //-----------------------Typography Section -----------------------// // Add Typography section $wp_customize->add_section('typography', array('title' => __('Typography'), 'description' => __('Customize the site typography here. Insert Google Fonts code (eg. http://fonts.googleapis.com/css?family=Lora) and then enter the font name (eg. Lora) in the desired section.'), 'priority' => 22)); //Typography Settings //Google Font Link Field $wp_customize->add_setting('google_font_code', array('sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control('google_font_code', array('type' => 'text', 'label' => __('Google Font Link Code'), 'section' => 'typography')); //Primary Font $wp_customize->add_setting('primary_font_family', array('sanitize_callback' => 'coastal_sanitize_text')); $wp_customize->add_control('primary_font_family', array('label' => __('Primary Font Family'), 'section' => 'typography')); //Secondary Font $wp_customize->add_setting('secondary_font_family', array('sanitize_callback' => 'coastal_sanitize_text')); $wp_customize->add_control('secondary_font_family', array('label' => __('Body Text Font Family'), 'section' => 'typography')); //Primary text color $wp_customize->add_setting('primary-text-color', array('default' => '#333333', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'primary-text-color', array('label' => __('Text Color'), 'section' => 'typography', 'settings' => 'primary-text-color', 'description' => __('Note: home page section text colors are controlled individually via the page editor.')))); //Link color $wp_customize->add_setting('link-color', array('default' => '#333333', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link-color', array('label' => __('Link Color'), 'section' => 'typography', 'settings' => 'link-color'))); //-----------------------Portfolio Pages Section -----------------------// $wp_customize->add_section('portfolio_pages', array('title' => __('Portfolio Pages'), 'description' => __('These settings apply for Portfolio pages only.'), 'priority' => 24)); // Add portfolio sidebar layout selector $wp_customize->add_setting('portfolio_sidebar', array('default' => 'full-width-content')); $wp_customize->add_control('portfolio_sidebar', array('type' => 'select', 'label' => 'Select portfolio sidebar style:', 'section' => 'portfolio_pages', 'choices' => array('content-sidebar' => 'Content, Primary Sidebar', 'full-width-content' => 'Full Width Content'))); //Go Back button URL $wp_customize->add_setting('backbtn-url', array('sanitize_callback' => 'coastal_sanitize_text')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'backbtn-url', array('label' => __('Back Button URL'), 'section' => 'portfolio_pages', 'settings' => 'backbtn-url', 'type' => 'text'))); //Go Back button Text $wp_customize->add_setting('backbtn-text', array('sanitize_callback' => 'coastal_sanitize_text')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'backbtn-text', array('label' => __('Back Button Text'), 'section' => 'portfolio_pages', 'settings' => 'backbtn-text', 'type' => 'text'))); //Display author by line $wp_customize->add_setting('portf_display_share_buttons', array('sanitize_callback' => 'sanitize_checkbox')); $wp_customize->add_control('portf_display_share_buttons', array('type' => 'checkbox', 'label' => __('Display share buttons'), 'section' => 'portfolio_pages')); //----------------------- Blog Index Section -----------------------// $wp_customize->add_section('blog_post', array('title' => __('Blog Index'), 'description' => __('These settings apply to main blog index or blog archive page only.'), 'priority' => 25)); //Add default Genesis controls $wp_customize->get_control('genesis_content_archive')->section = 'blog_post'; $wp_customize->get_control('genesis_content_archive_limit')->section = 'blog_post'; //Default layout $wp_customize->add_setting('blog_layout', array('default' => genesis_get_default_layout())); $wp_customize->add_control('blog_layout', array('label' => __('Select Default Layout', 'genesis'), 'section' => 'blog_post', 'settings' => 'blog_layout', 'type' => 'select', 'priority' => 10, 'choices' => genesis_get_layouts_for_customizer())); //Displaypost date $wp_customize->add_setting('display_post_date', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 1)); $wp_customize->add_control('display_post_date', array('type' => 'checkbox', 'label' => __('Display post date'), 'section' => 'blog_post')); //Display author by line $wp_customize->add_setting('display_byline', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 0)); $wp_customize->add_control('display_byline', array('type' => 'checkbox', 'label' => __('Display author byline'), 'section' => 'blog_post')); //Comment count $wp_customize->add_setting('display_comment_count', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 0)); $wp_customize->add_control('display_comment_count', array('type' => 'checkbox', 'label' => __('Display comment count'), 'section' => 'blog_post')); //Display Share buttons on blog index $wp_customize->add_setting('display_share_buttons', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 1)); $wp_customize->add_control('display_share_buttons', array('type' => 'checkbox', 'label' => __('Display share links on main blog page'), 'section' => 'blog_post')); //AddThis Publisher ID $wp_customize->add_setting('coastal_addthis_pub_id', array('sanitize_callback' => 'coastal_sanitize_text', 'transport' => 'postMessage')); $wp_customize->add_control('coastal_addthis_pub_id', array('label' => __('AddThis Publisher ID'), 'section' => 'blog_post', 'description' => __('Paste your AddThis publisher ID here to get analytics on how your content is shared.'))); //----------------------- Single Blog Posts Section -----------------------// $wp_customize->add_section('single_blog_post', array('title' => __('Single Blog Posts '), 'description' => __('These settings apply to individual blog posts only.'), 'priority' => 26)); //Display Share buttons on blog index $wp_customize->add_setting('single_display_featured_image', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 1)); $wp_customize->add_control('single_display_featured_image', array('type' => 'checkbox', 'label' => __('Display featured image on single posts'), 'section' => 'single_blog_post')); //Display Categories $wp_customize->add_setting('single_display_categories', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 0)); $wp_customize->add_control('single_display_categories', array('type' => 'checkbox', 'label' => __('Display categories'), 'section' => 'single_blog_post')); //Display Tags $wp_customize->add_setting('single_display_tags', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 0)); $wp_customize->add_control('single_display_tags', array('type' => 'checkbox', 'label' => __('Display tags'), 'section' => 'single_blog_post')); //Display Share buttons on single blog post $wp_customize->add_setting('single_display_share_buttons', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 1)); $wp_customize->add_control('single_display_share_buttons', array('type' => 'checkbox', 'label' => __('Display share links on single posts'), 'section' => 'single_blog_post')); //Display Go Back button on single blog post $wp_customize->add_setting('single_display_go_back', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 1)); $wp_customize->add_control('single_display_go_back', array('type' => 'checkbox', 'label' => __('Display "Go Back" button on posts'), 'section' => 'single_blog_post')); //-----------------------Footer Settings Section -----------------------// // Add Footer Settings section $wp_customize->add_section('footer_settings', array('title' => __('Footer'), 'priority' => 200)); //Change number of columns $wp_customize->add_setting('footer_col_number', array('default' => 'footer-col-varied-3')); $wp_customize->add_control('footer_col_number', array('type' => 'select', 'label' => __('Choose number of columns for footer'), 'section' => 'footer_settings', 'choices' => array('footer-col-1' => __('1 column'), 'footer-col-2' => __('2 columns'), 'footer-col-3' => __('3 columns'), 'footer-col-varied-3' => __('3 columns varied width'), 'footer-col-4' => __('4 columns')))); //Copyright footer text section $wp_customize->add_setting('copyright-footer', array('sanitize_callback' => 'coastal_sanitize_text')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'copyright-footer', array('label' => __('Footer Copyright Text'), 'section' => 'footer_settings', 'settings' => 'copyright-footer', 'type' => 'text', 'description' => __('Add text to display in the footer copyright section.')))); //Remove stnsvn footer credit $wp_customize->add_setting('stnsvn-credit', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 0)); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'stnsvn-credit', array('label' => __('Hide Station Seven credit?'), 'section' => 'footer_settings', 'settings' => 'stnsvn-credit', 'type' => 'checkbox', 'description' => __('While of course not required, we appreciate any support as we grow our business :)')))); //-----------------------Navigation Menu -----------------------// // Add Navigation section $wp_customize->add_section('navigation', array('title' => __('Navigation Style'), 'description' => __('Customize the look of the nav menus here.'), 'priority' => 100)); //Secondary nav menu background color $wp_customize->add_setting('sec_nav_bg_color', array('default' => '#FFF', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sec_nav_bg_color', array('label' => __('Secondary Nav Background Color'), 'section' => 'navigation', 'settings' => 'sec_nav_bg_color'))); //Secondary nav menu text color $wp_customize->add_setting('sec_nav_text_color', array('default' => '#333333', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'sec_nav_text_color', array('label' => __('Secondary Nav Text Color'), 'section' => 'navigation', 'settings' => 'sec_nav_text_color'))); //Activate Secondary Menu $wp_customize->add_setting('sticky_secondary_menu', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 0)); $wp_customize->add_control('sticky_secondary_menu', array('type' => 'checkbox', 'label' => __('Disable secondary nav stickiness'), 'section' => 'navigation')); //Activate Secondary Menu transpareny effect $wp_customize->add_setting('transparent_secondary_menu', array('sanitize_callback' => 'sanitize_checkbox', 'default' => 0)); $wp_customize->add_control('transparent_secondary_menu', array('type' => 'checkbox', 'label' => __('Disable secondary nav transparency'), 'section' => 'navigation')); //-----------------------Custom CSS Section -----------------------// // Add CSS section $wp_customize->add_section('coastal_css', array('title' => __('Custom CSS'), 'description' => __('Add any custom CSS here.'), 'priority' => 100)); $wp_customize->add_setting('coastal_css_box', array('sanitize_callback' => 'coastal_sanitize_text', 'transport' => 'postMessage')); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'coastal_css_box', array('label' => __('Custom CSS'), 'section' => 'coastal_css', 'settings' => 'coastal_css_box', 'type' => 'textarea'))); //Check to see if admin and using customizer before updating live css if ($wp_customize->is_preview() && !is_admin()) { add_action('wp_footer', 'customize_preview', 21); } }