layers_can_show_sidebar
The Layers layers can show sidebar function.
Description
layers_can_show_sidebar( (string) $sidebar = 'left-sidebar' );
Parameters (1)
- 0. $sidebar — Optional. (string) =>
'left-sidebar'
- The sidebar.
Usage
if ( !function_exists( 'layers_can_show_sidebar' ) ) { require_once '/core/helpers/template.php'; } // The sidebar. $sidebar = 'left-sidebar'; // NOTICE! Understand what this does before running. $result = layers_can_show_sidebar($sidebar);
Defined (1)
The function is defined in the following location(s).
- /core/helpers/template.php
- function layers_can_show_sidebar( $sidebar = 'left-sidebar' ) {
- if ( is_page_template( 'template-blog.php' ) ) {
- // Check the arhive page option
- $can_show_sidebar = layers_get_theme_mod( 'archive-' . $sidebar );
- } else if( is_page() ) {
- // Check the pages use page templates to decide which sidebars are allowed
- $can_show_sidebar =
- (
- is_page_template( 'template-' . $sidebar . '.php' ) ||
- is_page_template( 'template-both-sidebar.php' )
- );
- } elseif ( is_single() ) {
- // Check the single page option
- $can_show_sidebar = layers_get_theme_mod( 'single-' . $sidebar );
- } else {
- // Check the arhive page option
- $can_show_sidebar = layers_get_theme_mod( 'archive-' . $sidebar );
- }
- return $classes = apply_filters( 'layers_can_show_sidebar', $can_show_sidebar, $sidebar );
- }