responsive_mobile_get_layout

Get current layout.

Description

responsive_mobile_get_layout(); 

Usage

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

Defined (1)

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

/includes/functions-layout.php  
  1. function responsive_mobile_get_layout() { 
  2.  
  3. if ( is_404() ) { 
  4. return 'default'; 
  5.  
  6. $layout = ''; 
  7. $responsive_mobile_options = responsive_mobile_get_options(); 
  8. $valid_layouts = responsive_mobile_valid_layouts(); 
  9.  
  10. /** For singular pages, get post meta */ 
  11. if ( is_singular() ) { 
  12. global $post; 
  13. /** Static pages */ 
  14. if ( is_page() ) { 
  15. $page_template = get_page_template_slug( $post->ID ); 
  16.  
  17. /** If custom page template is default, use page template first */ 
  18. if ( in_array( $page_template, array( 'page-templates/blog.php', 'page-templates/blog-excerpt.php' ) ) ) { 
  19. if ( 'default' == $responsive_mobile_options['blog_posts_index_layout_default'] ) { 
  20. $layout = basename( $page_template, '.php'); 
  21. } else { 
  22. $layout = $responsive_mobile_options['blog_posts_index_layout_default']; 
  23.  
  24. } else { 
  25. // If page is set to default then display default layout 
  26. if ( '' == $page_template ) { 
  27. $layout = $responsive_mobile_options['static_page_layout_default']; 
  28. // Otherwise get the page template 
  29. else { 
  30. $layout = basename( $page_template, '.php'); 
  31.  
  32. } /** Single blog posts */ 
  33. elseif ( is_single() ) { 
  34. $layout_meta_value = ( false != get_post_meta( $post->ID, '_responsive_mobile_layout', true ) ? get_post_meta( $post->ID, '_responsive_mobile_layout', true ) : 'default' ); 
  35. $layout_meta = ( array_key_exists( $layout_meta_value, $valid_layouts ) ? $layout_meta_value : 'default' ); 
  36.  
  37. /** If post custom meta is set, use it */ 
  38. if ( 'default' != $layout_meta ) { 
  39. $layout = $layout_meta; 
  40. } /** Else, use the default */ 
  41. else { 
  42. $layout = $responsive_mobile_options['single_post_layout_default']; 
  43.  
  44. } else { 
  45. /** Posts index */ 
  46. if ( is_home() || is_archive() || is_search() ) { 
  47. $layout = $responsive_mobile_options['blog_posts_index_layout_default']; 
  48. } /** Fallback */ 
  49. else { 
  50. $layout = 'default'; 
  51.  
  52.  
  53. $layout = apply_filters( 'responsive_mobile_get_layout', $layout ); 
  54.  
  55. return esc_attr( $layout );