evolve_lets_get_sidebar

Function to determine whether to get_sidebar, depending on theme options layout and post meta layout.

Description

(boolean) evolve_lets_get_sidebar(); 

used in 404.php, archive.php, attachment.php, author.php, bbpress.php, blog-page.php,... buddypress.php, index.php, page.php, search.php single.php

Returns (boolean)

indicates whether to load sidebar. added by Denzel


Usage

  1. if ( !function_exists( 'evolve_lets_get_sidebar' ) ) { 
  2. require_once '/library/functions/basic-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = evolve_lets_get_sidebar(); 
  7.  

Defined (1)

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

/library/functions/basic-functions.php  
  1. function evolve_lets_get_sidebar() { 
  2.  
  3. global $wp_query, $post; 
  4. $post_id = ''; 
  5. if ($wp_query->is_posts_page) { 
  6. $post_id = get_option('page_for_posts'); 
  7. } elseif (is_buddypress()) { 
  8. $post_id = evolve_bp_get_id(); 
  9. } else { 
  10. $post_id = isset($post->ID) ? $post->ID : ''; 
  11.  
  12. $get_sidebar = false; 
  13.  
  14. $evolve_layout = evolve_get_option('evl_layout', '2cl'); 
  15.  
  16. if ($evolve_layout != "1c") { 
  17. $get_sidebar = true; 
  18.  
  19. if (( is_page() || is_single() || $wp_query->is_posts_page || is_buddypress() || is_bbpress()) && get_post_meta($post_id, 'evolve_full_width', true) == 'yes') { 
  20. $get_sidebar = false; 
  21.  
  22. if (is_single() || is_page() || $wp_query->is_posts_page || is_buddypress() || is_bbpress()): 
  23.  
  24. $evolve_sidebar_position = get_post_meta($post_id, 'evolve_sidebar_position', true); 
  25.  
  26. if ($evolve_sidebar_position != 'default' && $evolve_sidebar_position != '') { 
  27. $get_sidebar = true; 
  28.  
  29. endif; 
  30.  
  31. return $get_sidebar;