srikat

home.php

Oct 17th, 2013
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.28 KB | None | 0 0
  1. <?php
  2.  
  3. add_action( 'genesis_meta', 'outreach_home_genesis_meta' );
  4. /**
  5.  * Add widget support for homepage. If no widgets active, display the default loop.
  6.  *
  7.  */
  8. function outreach_home_genesis_meta() {
  9.  
  10.     if ( is_active_sidebar( 'home-featured' ) || is_active_sidebar( 'below-home-featured' ) || is_active_sidebar( 'home-1' ) || is_active_sidebar( 'home-2' ) || is_active_sidebar( 'home-3' ) || is_active_sidebar( 'home-4' ) ) {
  11.  
  12.         remove_action( 'genesis_loop', 'genesis_do_loop' );
  13.         add_action( 'genesis_loop', 'outreach_home_featured' );
  14.         add_action( 'genesis_before_footer', 'outreach_below_home_featured' );
  15.         add_action( 'genesis_before_footer', 'outreach_home_sections', 3 );
  16.         add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
  17.         add_filter( 'body_class', 'add_body_class' );
  18.  
  19.         function add_body_class( $classes ) {
  20.             $classes[] = 'outreach';
  21.             return $classes;
  22.         }
  23.  
  24.     }
  25. }
  26.  
  27. function outreach_home_featured() {
  28.  
  29.     if ( is_active_sidebar( 'home-featured' ) ) {
  30.        genesis_widget_area( 'home-featured', array(
  31.            'before' => '<div class="home-featured widget-area">'
  32.        ) );
  33.     }
  34.  
  35. }
  36. function outreach_below_home_featured() {
  37.  
  38.     if ( is_active_sidebar( 'below-home-featured' ) ) {
  39.         remove_action( 'genesis_post_content', 'genesis_do_post_image' );
  40.        genesis_widget_area( 'below-home-featured', array(
  41.            'before' => '<div class="below-home-featured widget-area"><div class="wrap">',
  42.            'after'  => '</div></div>'
  43.        ) );
  44.     }
  45.  
  46. }
  47.  
  48. function outreach_home_sections() {
  49.  
  50.     if ( is_active_sidebar( 'home-1' ) || is_active_sidebar( 'home-2' ) || is_active_sidebar( 'home-3' ) || is_active_sidebar( 'home-4' ) ) {
  51.  
  52.         echo '<div id="home-sections"><div class="wrap">';
  53.  
  54.            genesis_widget_area( 'home-1', array(
  55.                'before' => '<div class="home-1 widget-area">',
  56.            ) );
  57.  
  58.            genesis_widget_area( 'home-2', array(
  59.                'before' => '<div class="home-2 widget-area">',
  60.            ) );
  61.  
  62.            genesis_widget_area( 'home-3', array(
  63.                'before' => '<div class="home-3 widget-area">',
  64.            ) );
  65.  
  66.            genesis_widget_area( 'home-4', array(
  67.                'before' => '<div class="home-4 widget-area">',
  68.            ) );
  69.  
  70.         echo '</div><!-- end .wrap --></div><!-- end #home-sections -->';
  71.  
  72.     }
  73.  
  74. }
  75.  
  76. genesis();
Advertisement
Add Comment
Please, Sign In to add comment