Advertisement
Guest User

Move widget areas

a guest
Dec 4th, 2014
156
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.51 KB | None
  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.    
  53.     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' ) ) {
  54.  
  55.         echo '<div class="home-bottom">';
  56.  
  57.         genesis_widget_area( 'home-bottom-left', array(
  58.             'before' => '<div class="home-bottom-left widget-area">',
  59.             'after'  => '</div>',
  60.         ) );
  61.  
  62.         genesis_widget_area( 'home-bottom-left-two', array(
  63.             'before' => '<div class="home-bottom-left widget-area">',
  64.             'after'  => '</div>',
  65.         ) );
  66.  
  67.     genesis_widget_area( 'home-bottom-left-three', array(
  68.             'before' => '<div class="home-bottom-left widget-area">',
  69.             'after'  => '</div>',
  70.         ) );
  71.  
  72.     genesis_widget_area( 'home-bottom-left-four', array(
  73.             'before' => '<div class="home-bottom-left widget-area">',
  74.             'after'  => '</div>',
  75.         ) );
  76.  
  77.         echo '</div>';
  78.     }
  79.  
  80.   genesis_widget_area( 'home-bottom-right', array(
  81.         'before' => '<div class="home-bottom-right widget-area">',
  82.         'after'  => '</div>',
  83.     ) );
  84.  
  85. }
  86.  
  87. genesis();
Advertisement
RAW Paste Data Copied
Advertisement