evolve_layout_class

Function to print out css class according to layout or post meta used in content-blog.php, index.php, buddypress.php, bbpress.php.

Description

evolve_layout_class( (int) $type = 1 ); 

Parameters (1)

0. $type — Optional. (int) => 1
The type.

Usage

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

Defined (1)

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

/library/functions/basic-functions.php  
  1. function evolve_layout_class($type = 1) { 
  2. //$type = 1 is for content-blog.php and index.php, which includes the get_post_meta($post->ID, 'evolve_full_width', true).. 
  3. //$type = 2 is for buddypress.php and bbpress.php, which EXCLUDES the get_post_meta($post->ID, 'evolve_full_width', true)..  
  4. global $post; 
  5. global $wp_query; 
  6. $evolve_layout = evolve_get_option('evl_layout', '2cl'); 
  7. $evolve_post_layout = evolve_get_option('evl_post_layout', 'two'); 
  8.  
  9. $post_id = ''; 
  10. if ($wp_query->is_posts_page) { 
  11. $post_id = get_option('page_for_posts'); 
  12. } elseif (is_buddypress()) { 
  13. $post_id = evolve_bp_get_id(); 
  14. } else { 
  15. $post_id = isset($post->ID) ? $post->ID : ''; 
  16.  
  17. $layout_css = ''; 
  18.  
  19. if ($evolve_layout == "1c") { 
  20. $layout_css.= ' col-md-12'; 
  21. } else { 
  22.  
  23. $layout_css.= ' col-xs-12 col-sm-6'; 
  24.  
  25. if (($evolve_layout == "2cr" && ($evolve_post_layout == "two") || $evolve_layout == "2cl" && ($evolve_post_layout == "two"))) { 
  26. $layout_css.= ' col-md-8'; 
  27.  
  28. if (($evolve_layout == "3cm" || $evolve_layout == "3cl" || $evolve_layout == "3cr")) { 
  29. $layout_css.= ' col-md-6'; 
  30. } else { 
  31. $layout_css.= ' col-md-8'; 
  32.  
  33. if (is_single() || is_page() || is_404() || is_search()) { 
  34. $layout_css.= ' col-single'; 
  35.  
  36. if ($type == 1) { 
  37.  
  38.  
  39. if (class_exists('Woocommerce')): 
  40. if (is_cart() || is_checkout() || is_account_page() || (get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id')))) { 
  41. $layout_css .= ' full-width'; 
  42. endif; 
  43.  
  44. if (is_single() || is_page() || $wp_query->is_posts_page || is_buddypress() || is_bbpress()): 
  45.  
  46. $evolve_sidebar_position = get_post_meta($post_id, 'evolve_sidebar_position', true); 
  47.  
  48. if (($type == 1 && $evolve_sidebar_position == 'default') || ($type == 2 && $evolve_sidebar_position == 'default')) { 
  49. if (get_post_meta($post_id, 'evolve_full_width', true) == 'yes') { 
  50. $layout_css .= ' full-width'; 
  51.  
  52. if ($evolve_sidebar_position == '2cl') { 
  53. $layout_css = 'col-xs-12 col-sm-6 col-md-8 col-md-8 float-left'; 
  54.  
  55. if ($evolve_sidebar_position == '2cr') { 
  56. $layout_css = 'col-xs-12 col-sm-6 col-md-8 col-md-8 float-right'; 
  57.  
  58. if ($evolve_sidebar_position == "3cm") { 
  59. $layout_css = 'col-xs-12 col-sm-6 col-md-6 float-left'; 
  60.  
  61. if ($evolve_sidebar_position == "3cr") { 
  62. $layout_css = 'col-xs-12 col-sm-6 col-md-6 float-right'; 
  63.  
  64. if ($evolve_sidebar_position == "3cl") { 
  65. $layout_css = 'col-xs-12 col-sm-6 col-md-6 float-left'; 
  66.  
  67. if (is_single() || is_page() || $wp_query->is_posts_page) { 
  68. $layout_css.= ' col-single'; 
  69.  
  70. endif; 
  71.  
  72. echo $layout_css;