catchresponsive_get_theme_layout

Returns Theme Layout prioritizing the meta box layouts.

Description

catchresponsive_get_theme_layout(); 

Usage

  1. if ( !function_exists( 'catchresponsive_get_theme_layout' ) ) { 
  2. require_once '/inc/catchresponsive-core.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = catchresponsive_get_theme_layout(); 
  7.  

Defined (1)

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

/inc/catchresponsive-core.php  
  1. function catchresponsive_get_theme_layout() { 
  2. $id = ''; 
  3.  
  4. global $post, $wp_query; 
  5.  
  6. // Front page displays in Reading Settings 
  7. $page_on_front = get_option('page_on_front') ; 
  8. $page_for_posts = get_option('page_for_posts'); 
  9.  
  10. // Get Page ID outside Loop 
  11. $page_id = $wp_query->get_queried_object_id(); 
  12.  
  13. // Blog Page or Front Page setting in Reading Settings 
  14. if ( $page_id == $page_for_posts || $page_id == $page_on_front ) { 
  15. $id = $page_id; 
  16. elseif ( is_singular() ) { 
  17. if ( is_attachment() ) { 
  18. $id = $post->post_parent; 
  19. else { 
  20. $id = $post->ID; 
  21.  
  22. //Get appropriate metabox value of layout 
  23. if ( '' != $id ) { 
  24. $layout = get_post_meta( $id, 'catchresponsive-layout-option', true ); 
  25. else { 
  26. $layout = 'default'; 
  27.  
  28. //Load options data 
  29.  
  30. //check empty and load default 
  31. if ( empty( $layout ) || 'default' == $layout ) { 
  32. $layout = $options['theme_layout']; 
  33.  
  34. return $layout;