Advertisement
Guest User

Move widget in Lifestyle

a guest
Dec 4th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. <?php
  2. /**
  3. * This file adds the Home Page to the Lifestyle Pro Theme.
  4. *
  5. * @author StudioPress
  6. * @package Lifestyle Pro
  7. * @subpackage Customizations
  8. */
  9.  
  10. add_action( 'genesis_meta', 'lifestyle_home_genesis_meta' );
  11. /**
  12. * Add widget support for homepage. If no widgets active, display the default loop.
  13. *
  14. */
  15. function lifestyle_home_genesis_meta() {
  16.  
  17. if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-bottom-left' ) || is_active_sidebar( 'home-bottom-left-two' ) || is_active_sidebar( 'home-bottom-right-three' ) || is_active_sidebar( 'home-bottom-right-four' ) || is_active_sidebar( 'home-bottom-right' ) ) {
  18.  
  19. // Force content-sidebar layout setting
  20. add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
  21.  
  22. // Add lifestyle-pro-home body class
  23. add_filter( 'body_class', 'lifestyle_body_class' );
  24.  
  25. // Remove the default Genesis loop
  26. remove_action( 'genesis_loop', 'genesis_do_loop' );
  27.  
  28. // Add homepage widgets
  29. add_action( 'genesis_loop', 'lifestyle_homepage_widgets' );
  30.  
  31. }
  32. }
  33.  
  34. function lifestyle_body_class( $classes ) {
  35.  
  36. $classes[] = 'lifestyle-pro-home';
  37. return $classes;
  38.  
  39. }
  40.  
  41. function lifestyle_homepage_widgets() {
  42.  
  43. genesis_widget_area( 'home-top', array(
  44. 'before' => '<div class="home-top widget-area">',
  45. 'after' => '</div>',
  46. ) );
  47.  
  48. genesis_widget_area( 'home-middle', array(
  49. 'before' => '<div class="home-middle widget-area">',
  50. 'after' => '</div>',
  51. ) );
  52. genesis_widget_area( 'home-bottom-right', array(
  53. 'before' => '<div class="home-bottom-right widget-area">',
  54. 'after' => '</div>',
  55. ) );
  56.  
  57. if ( is_active_sidebar( 'home-bottom-left' ) || is_active_sidebar( 'home-bottom-left-two' ) || is_active_sidebar( 'home-bottom-left-three' ) || is_active_sidebar( 'home-bottom-left-four' ) ) {
  58.  
  59. echo '<div class="home-bottom">';
  60.  
  61. genesis_widget_area( 'home-bottom-left', array(
  62. 'before' => '<div class="home-bottom-left widget-area">',
  63. 'after' => '</div>',
  64. ) );
  65.  
  66. genesis_widget_area( 'home-bottom-left-two', array(
  67. 'before' => '<div class="home-bottom-left widget-area">',
  68. 'after' => '</div>',
  69. ) );
  70.  
  71. genesis_widget_area( 'home-bottom-left-three', array(
  72. 'before' => '<div class="home-bottom-left widget-area">',
  73. 'after' => '</div>',
  74. ) );
  75.  
  76. genesis_widget_area( 'home-bottom-left-four', array(
  77. 'before' => '<div class="home-bottom-left widget-area">',
  78. 'after' => '</div>',
  79. ) );
  80.  
  81. echo '</div>';
  82. }
  83.  
  84. }
  85.  
  86. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement