/**
  * Create an admin menu item and settings page.
  *
  * @since 1.8.0
  *
  * @uses GENESIS_ADMIN_IMAGES_URL     URL for admin images.
  * @uses GENESIS_SETTINGS_FIELD       Settings field key.
  * @uses PARENT_DB_VERSION            Genesis database version.
  * @uses PARENT_THEME_VERSION         Genesis Framework version.
  * @uses genesis_get_default_layout() Get default layout.
  * @uses \Genesis_Admin::create()     Create an admin menu item and settings page.
  */
 function __construct()
 {
     $page_id = 'genesis';
     $menu_ops = apply_filters('genesis_theme_settings_menu_ops', array('main_menu' => array('sep' => array('sep_position' => '58.995', 'sep_capability' => 'edit_theme_options'), 'page_title' => 'Theme Settings', 'menu_title' => 'Genesis', 'capability' => 'edit_theme_options', 'icon_url' => GENESIS_ADMIN_IMAGES_URL . '/genesis-menu.png', 'position' => '58.996'), 'first_submenu' => array('page_title' => __('Theme Settings', 'genesis'), 'menu_title' => __('Theme Settings', 'genesis'), 'capability' => 'edit_theme_options')));
     $page_ops = apply_filters('genesis_theme_settings_page_ops', array('save_button_text' => __('Save Settings', 'genesis'), 'reset_button_text' => __('Reset Settings', 'genesis'), 'saved_notice_text' => __('Settings saved.', 'genesis'), 'reset_notice_text' => __('Settings reset.', 'genesis'), 'error_notice_text' => __('Error saving settings.', 'genesis')));
     $settings_field = GENESIS_SETTINGS_FIELD;
     $default_settings = apply_filters('genesis_theme_settings_defaults', array('update' => 1, 'update_email' => 0, 'update_email_address' => '', 'blog_title' => 'text', 'style_selection' => '', 'site_layout' => genesis_get_default_layout(), 'superfish' => 0, 'nav_extras' => '', 'nav_extras_twitter_id' => '', 'nav_extras_twitter_text' => __('Follow me on Twitter', 'genesis'), 'feed_uri' => '', 'redirect_feed' => 0, 'comments_feed_uri' => '', 'redirect_comments_feed' => 0, 'comments_pages' => 0, 'comments_posts' => 1, 'trackbacks_pages' => 0, 'trackbacks_posts' => 1, 'breadcrumb_home' => 0, 'breadcrumb_front_page' => 0, 'breadcrumb_posts_page' => 0, 'breadcrumb_single' => 0, 'breadcrumb_page' => 0, 'breadcrumb_archive' => 0, 'breadcrumb_404' => 0, 'breadcrumb_attachment' => 0, 'content_archive' => 'full', 'content_archive_thumbnail' => 0, 'image_size' => '', 'image_alignment' => 'alignleft', 'posts_nav' => 'numeric', 'blog_cat' => '', 'blog_cat_exclude' => '', 'blog_cat_num' => 10, 'header_scripts' => '', 'footer_scripts' => '', 'theme_version' => PARENT_THEME_VERSION, 'db_version' => PARENT_DB_VERSION, 'first_version' => genesis_first_version()));
     $this->create($page_id, $menu_ops, $page_ops, $settings_field, $default_settings);
     add_action('genesis_settings_sanitizer_init', array($this, 'sanitizer_filters'));
 }
 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);
    }
}
Example #4
0
/**
 * This function checks both the custom field and
 * the theme option to find the user-selected site
 * layout, and returns it.
 *
 * @since 0.2.2
 */
function genesis_site_layout()
{
    // If viewing a singular page/post
    if (is_singular()) {
        $custom_field = genesis_get_custom_field('_genesis_layout');
        $site_layout = $custom_field ? $custom_field : genesis_get_option('site_layout');
    } elseif (is_category() || is_tag() || is_tax()) {
        global $wp_query;
        $term = $wp_query->get_queried_object();
        $site_layout = $term && isset($term->meta['layout']) && $term->meta['layout'] ? $term->meta['layout'] : genesis_get_option('site_layout');
    } elseif (is_author()) {
        $site_layout = get_the_author_meta('layout', (int) get_query_var('author')) ? get_the_author_meta('layout', (int) get_query_var('author')) : genesis_get_option('site_layout');
    } else {
        $site_layout = genesis_get_option('site_layout');
    }
    // Use default layout as a fallback, if necessary
    if (!genesis_get_layout($site_layout)) {
        $site_layout = genesis_get_default_layout();
    }
    return esc_attr(apply_filters('genesis_site_layout', $site_layout));
}
Example #5
0
/**
 * Return the site layout for different contexts.
 *
 * Checks both the custom field and the theme option to find the user-selected site layout, and returns it.
 *
 * Applies `genesis_site_layout` filter early to allow shortcutting of function.
 *
 * @since 0.2.2
 *
 * @uses genesis_get_custom_field()              Get per-post layout value.
 * @uses genesis_get_option()                    Get theme setting layout value.
 * @uses genesis_get_default_layout()            Get default from registered layouts.
 * @uses genesis_has_post_type_archive_support() Check if a post type supports an archive setting page.
 *
 * @global WP_Query $wp_query Query object.
 *
 * @param boolean $use_cache Conditional to use cache or get fresh.
 *
 * @return string Key of layout.
 */
function genesis_site_layout($use_cache = true)
{
    //* Allow child theme to short-circuit this function
    $pre = apply_filters('genesis_site_layout', null);
    if (null !== $pre) {
        return $pre;
    }
    //* If we're supposed to use the cache, setup cache. Use if value exists.
    if ($use_cache) {
        //* Setup cache
        static $layout_cache = '';
        //* If cache is populated, return value
        if ('' !== $layout_cache) {
            return esc_attr($layout_cache);
        }
    }
    global $wp_query;
    //* If viewing a singular page or post, or the posts page, but not the front page
    if (is_singular() || is_home() && !genesis_is_root_page()) {
        $post_id = is_home() ? get_option('page_for_posts') : null;
        $custom_field = genesis_get_custom_field('_genesis_layout', $post_id);
        $site_layout = $custom_field ? $custom_field : genesis_get_option('site_layout');
    } elseif (is_category() || is_tag() || is_tax()) {
        $term = $wp_query->get_queried_object();
        $site_layout = $term && isset($term->meta['layout']) && $term->meta['layout'] ? $term->meta['layout'] : genesis_get_option('site_layout');
    } elseif (is_post_type_archive() && genesis_has_post_type_archive_support()) {
        $site_layout = genesis_get_cpt_option('layout') ? genesis_get_cpt_option('layout') : genesis_get_option('site_layout');
    } elseif (is_author()) {
        $site_layout = get_the_author_meta('layout', (int) get_query_var('author')) ? get_the_author_meta('layout', (int) get_query_var('author')) : genesis_get_option('site_layout');
    } else {
        $site_layout = genesis_get_option('site_layout');
    }
    //* Use default layout as a fallback, if necessary
    if (!genesis_get_layout($site_layout)) {
        $site_layout = genesis_get_default_layout();
    }
    //* Push layout into cache, if caching turned on
    if ($use_cache) {
        $layout_cache = $site_layout;
    }
    //* Return site layout
    return esc_attr($site_layout);
}
/**
 * This function registers the default values for Genesis theme settings
 */
function genesis_theme_settings_defaults()
{
    $defaults = array('update' => 1, 'blog_title' => 'text', 'header_right' => 0, 'site_layout' => genesis_get_default_layout(), 'nav' => 1, 'nav_superfish' => 1, 'nav_extras_enable' => 0, 'nav_extras' => 'date', 'nav_extras_twitter_id' => '', 'nav_extras_twitter_text' => 'Follow me on Twitter', 'subnav' => 0, 'subnav_superfish' => 1, 'feed_uri' => '', 'comments_feed_uri' => '', 'redirect_feeds' => 0, 'comments_pages' => 0, 'comments_posts' => 1, 'trackbacks_pages' => 0, 'trackbacks_posts' => 1, 'breadcrumb_home' => 0, 'breadcrumb_single' => 0, 'breadcrumb_page' => 0, 'breadcrumb_archive' => 0, 'breadcrumb_404' => 0, 'content_archive' => 'full', 'content_archive_thumbnail' => 0, 'posts_nav' => 'older-newer', 'blog_cat' => '', 'blog_cat_exclude' => '', 'blog_cat_num' => 10, 'header_scripts' => '', 'footer_scripts' => '', 'theme_version' => PARENT_THEME_VERSION);
    return apply_filters('genesis_theme_settings_defaults', $defaults);
}
Example #7
0
/**
 * Returns the site layout for different contexts.
 *
 * Checks both the custom field and the theme option to find the user-selected
 * site layout, and returns it.
 *
 * Value is passed through genesis_site_layout filter just before returning.
 *
 * @since 0.2.2
 *
 * @uses genesis_get_custom_field() Get per-post layout value
 * @uses genesis_get_option() Get theme setting layout value
 * @uses genesis_get_default_layout() Get default from registered layouts
 *
 * @global WP_Query $wp_query
 * @param boolean $use_cache Conditional to use cache or get fresh.
 * @return string
 */
function genesis_site_layout($use_cache = true)
{
    /** Allow child theme to short-circuit this function */
    $pre = apply_filters('genesis_site_layout', null);
    if (null !== $pre) {
        return $pre;
    }
    /** If we're supposed to use the cache, setup cache. Use if value exists. */
    if ($use_cache) {
        /** Setup cache */
        static $layout_cache = '';
        /** If cache is populated, return value */
        if ($layout_cache !== '') {
            return esc_attr($layout_cache);
        }
    }
    global $wp_query;
    /** If viewing a singular page or post */
    if (is_singular()) {
        $custom_field = genesis_get_custom_field('_genesis_layout');
        $site_layout = $custom_field ? $custom_field : genesis_get_option('site_layout');
    } elseif (is_category() || is_tag() || is_tax()) {
        $term = $wp_query->get_queried_object();
        $site_layout = $term && isset($term->meta['layout']) && $term->meta['layout'] ? $term->meta['layout'] : genesis_get_option('site_layout');
    } elseif (is_author()) {
        $site_layout = get_the_author_meta('layout', (int) get_query_var('author')) ? get_the_author_meta('layout', (int) get_query_var('author')) : genesis_get_option('site_layout');
    } else {
        $site_layout = genesis_get_option('site_layout');
    }
    /** Use default layout as a fallback, if necessary */
    if (!genesis_get_layout($site_layout)) {
        $site_layout = genesis_get_default_layout();
    }
    /** Push layout into cache, if caching turned on */
    if ($use_cache) {
        $layout_cache = $site_layout;
    }
    /** Return site layout */
    return esc_attr($site_layout);
}