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

  1. if ( !function_exists( 'layers_can_show_sidebar' ) ) { 
  2. require_once '/core/helpers/template.php'; 
  3.  
  4. // The sidebar. 
  5. $sidebar = 'left-sidebar'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = layers_can_show_sidebar($sidebar); 
  9.  

Defined (1)

The function is defined in the following location(s).

/core/helpers/template.php  
  1. function layers_can_show_sidebar( $sidebar = 'left-sidebar' ) { 
  2.  
  3. if ( is_page_template( 'template-blog.php' ) ) { 
  4.  
  5. // Check the arhive page option 
  6. $can_show_sidebar = layers_get_theme_mod( 'archive-' . $sidebar ); 
  7.  
  8. } else if( is_page() ) { 
  9.  
  10. // Check the pages use page templates to decide which sidebars are allowed 
  11. $can_show_sidebar = 
  12. is_page_template( 'template-' . $sidebar . '.php' ) || 
  13. is_page_template( 'template-both-sidebar.php' ) 
  14. ); 
  15.  
  16. } elseif ( is_single() ) { 
  17.  
  18. // Check the single page option 
  19. $can_show_sidebar = layers_get_theme_mod( 'single-' . $sidebar ); 
  20.  
  21. } else { 
  22.  
  23. // Check the arhive page option 
  24. $can_show_sidebar = layers_get_theme_mod( 'archive-' . $sidebar ); 
  25.  
  26.  
  27. return $classes = apply_filters( 'layers_can_show_sidebar', $can_show_sidebar, $sidebar );