Beispiel #1
0
/**
 * Create and display plugin help tab content: "Layout Extras".
 *
 * @since 2.0.0
 *
 * @uses  ddw_gle_help_content_sub_head()
 * @uses  genesis_get_layout()
 */
function ddw_gle_help_content_layout_extras()
{
    ddw_gle_help_content_sub_head(__('Layouts', 'genesis-layout-extras'));
    /** Custom CSS advise */
    echo '<h4>' . __('Additional, alternate layout options', 'genesis-layout-extras') . ':</h4>' . '<p>' . __('Consider these more like variations of existing layouts. So, in the end you have even more flexibility with no overhead! This could be great for content oriented blogs, marketeers websites and so much more...', 'genesis-layout-extras') . ' &mdash; ' . __('Currently enabled', 'genesis-layout-extras') . ':</p>';
    if (genesis_get_layout('sidebars-below-content') && !defined('GPEX_PLUGIN_BASEDIR')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_sidebars_below_content', esc_url(plugins_url('images/gle_sbc.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Sidebars below Content', 'genesis-layout-extras') . '" /><span><em>' . __('Sidebars below Content', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as %s, but with Primary and Secondary sidebars below the content (as two fifty percent-wide responsive columns).', 'genesis-layout-extras'), '"' . __('Full Width Content', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if SBC layout check
    if (genesis_get_layout('primary-below-content')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_primary_below_content', esc_url(plugins_url('images/gle_pbc.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Primary below Content', 'genesis-layout-extras') . '" /><span><em>' . __('Primary below Content', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as %s, but with Primary sidebar below the content.', 'genesis-layout-extras'), '"' . __('Full Width Content', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if PBC layout check
    if (genesis_get_layout('primary-above-content')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_primary_above_content', esc_url(plugins_url('images/gle_pac.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Primary above Content', 'genesis-layout-extras') . '" /><span><em>' . __('Primary above Content', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as %s, but with Primary sidebar above the content.', 'genesis-layout-extras'), '"' . __('Full Width Content', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if PAC layout check
    if (genesis_get_layout('content-sidebaralt') && !defined('GPEX_PLUGIN_BASEDIR')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_content_sidebaralt', esc_url(plugins_url('images/gle_c-salt.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Content/Sidebar-Alt', 'genesis-layout-extras') . '" /><span><em>' . __('Content/Sidebar-Alt', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as a variation of %s.', 'genesis-layout-extras'), '"' . __('Content-Sidebar', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if CSA layout check
    if (genesis_get_layout('sidebaralt-content') && !defined('GPEX_PLUGIN_BASEDIR')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_sidebaralt_content', esc_url(plugins_url('images/gle_salt-c.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Sidebar-Alt/Content', 'genesis-layout-extras') . '" /><span><em>' . __('Sidebar-Alt/Content', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as a variation of %s.', 'genesis-layout-extras'), '"' . __('Sidebar-Content', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if SAC layout check
    if (genesis_get_layout('content-sidebaralt-sidebar')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_content_sidebaralt_sidebar', esc_url(plugins_url('images/gle_c-salt-s.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Content/Sidebar-Alt/Sidebar', 'genesis-layout-extras') . '" /><span><em>' . __('Content/Sidebar-Alt/Sidebar', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as a variation of %s.', 'genesis-layout-extras'), '"' . __('Content-Sidebar-Sidebar', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if CSAS layout check
    if (genesis_get_layout('sidebar-sidebaralt-content')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_sidebar_sidebaralt_content', esc_url(plugins_url('images/gle_s-salt-c.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Sidebar/Sidebar-Alt/Content', 'genesis-layout-extras') . '" /><span><em>' . __('Sidebar/Sidebar-Alt/Content', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as a variation of %s.', 'genesis-layout-extras'), '"' . __('Sidebar-Sidebar-Content', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if SSAC layout check
    if (genesis_get_layout('sidebar-content-sidebaralt')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_sidebar_content_sidebaralt', esc_url(plugins_url('images/gle_s-c-salt.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Sidebar/Content/Sidebar-Alt', 'genesis-layout-extras') . '" /><span><em>' . __('Sidebar/Content/Sidebar-Alt', 'genesis-layout-extras') . '</em><br />&rarr; ' . sprintf(__('Think of it as a variation of %s.', 'genesis-layout-extras'), '"' . __('Sidebar-Content-Sidebar', 'genesis-layout-extras') . '"') . '</span></div>';
    }
    // end if SCSA layout check
    if (genesis_get_layout('headernav-content-sidebar')) {
        echo '<div class="gle-layout-div"><img class="gle-layout-img alignleft" src="' . apply_filters('gle_filter_layout_image_headernav_content_sidebar', esc_url(plugins_url('images/gle_hncs.gif', dirname(__FILE__)))) . '" title="' . esc_html__('Header+Nav/Content/Sidebar', 'genesis-layout-extras') . '" /><span><em>' . __('Header+Nav/Content/Sidebar', 'genesis-layout-extras') . '</em><br />&rarr; ' . __('Think of it as a special variation of the 3-column layouts but with fixed left column which consists of re-positioned header together with widget area and footer mixed in.', 'genesis-layout-extras') . '</span></div>';
    }
    // end if HNCS layout check
    echo '</ul>' . '<p>' . __('These alternate layouts are fully responsive. All is working like it should with minimal additions on CSS style rules (only what\'s really needed).', 'genesis-layout-extras') . ' ' . __('Those CSS additions are optional (see settings below), you can also ever integrate the style rules with your child theme.', 'genesis-layout-extras') . '</p>';
}
/**
 * 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));
}
/**
 * Adding our own plugin's alternate layout options to the select drop-down menu.
 *
 * @since 2.0.0
 *
 * @uses  genesis_get_option()
 * @uses  ddw_gle_layout_select_option()
 *
 * @param string 	$gle_layout_option
 */
function ddw_gle_layouts_drop_down_plugin_alternate($gle_layout_option)
{
    /** Additional layouts: via THIS plugin 'Genesis Layout Extras' */
    if (genesis_get_option('gle_layout_sbc', GLE_SETTINGS_FIELD) && !defined('GPEX_PLUGIN_BASEDIR')) {
        ddw_gle_layout_select_option('sidebars-below-content', __('Sidebars below Content', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_option('gle_layout_pbc', GLE_SETTINGS_FIELD)) {
        ddw_gle_layout_select_option('primary-below-content', __('Primary below Content', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_option('gle_layout_pac', GLE_SETTINGS_FIELD)) {
        ddw_gle_layout_select_option('primary-above-content', __('Primary above Content', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_option('gle_layout_hncs', GLE_SETTINGS_FIELD)) {
        ddw_gle_layout_select_option('headernav-content-sidebar', __('Header+Nav/Content/Sidebar', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_option('gle_layout_c_salt', GLE_SETTINGS_FIELD) && !defined('GPEX_PLUGIN_BASEDIR')) {
        ddw_gle_layout_select_option('content-sidebaralt', __('Content/Sidebar-Alt', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_option('gle_layout_salt_c', GLE_SETTINGS_FIELD) && !defined('GPEX_PLUGIN_BASEDIR')) {
        ddw_gle_layout_select_option('sidebaralt-content', __('Sidebar-Alt/Content', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_option('gle_layout_c_salt_s', GLE_SETTINGS_FIELD)) {
        ddw_gle_layout_select_option('content-sidebaralt-sidebar', __('Content/Sidebar-Alt/Sidebar', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_option('gle_layout_s_salt_c', GLE_SETTINGS_FIELD)) {
        ddw_gle_layout_select_option('sidebar-sidebaralt-content', __('Sidebar/Sidebar-Alt/Content', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
    if (genesis_get_layout('sidebar-content-sidebaralt')) {
        ddw_gle_layout_select_option('sidebar-content-sidebaralt', __('Sidebar/Content/Sidebar-Alt', 'genesis-layout-extras'), '#ffe4c4', $gle_layout_option);
    }
}
Beispiel #4
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);
}
Beispiel #5
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);
}