boost2029

sidebar.php

Mar 20th, 2011
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.10 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The Sidebar containing the primary and secondary widget areas.
  4.  *
  5.  * @package WordPress
  6.  * @subpackage Pilcrow
  7.  * @since Pilcrow 1.0
  8.  */
  9. ?>
  10.  
  11.     <?php
  12.         /* If the current layout is no-sidebar, let's just get out of here.
  13.          * If the current layout is a 3-column one with 2 sidebars on the right or left
  14.          * Pilcrow enables a "Feature Widget Area" that should span both sidebar columns
  15.          * and adds a containing div around the main sidebars for the content-sidebar-sidebar
  16.          * and sidebar-sidebar-layouts so the layout holds together with a short content area and long featured widget area
  17.          */
  18.         $options = get_option( 'pilcrow_theme_options' );
  19.         $current_layout = $options['theme_layout'];
  20.         $feature_widget_area_layouts = array( 'content-sidebar-sidebar', 'sidebar-sidebar-content' );
  21.        
  22.         if ( 'no-sidebar' == $current_layout )
  23.             return;
  24.  
  25.         if ( in_array( $current_layout, $feature_widget_area_layouts ) ) :
  26.     ?>
  27.     <div id="main-sidebars">
  28.  
  29.         <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?>
  30.  
  31.         <div id="feature" class="widget-area" role="complementary">
  32.             <ul class="xoxo sidebar-list">
  33.                 <?php dynamic_sidebar( 'sidebar-3' ); ?>
  34.             </ul>
  35.         </div><!-- #feature.widget-area -->
  36.  
  37.         <?php endif; // ends the check for the current layout that determines the availability of the feature widget area ?>
  38.  
  39.         <?php endif; // ends the check for the current layout that determines the #main-sidebars markup ?>
  40.  
  41.         <div id="sidebar" class="widget-area" role="complementary">
  42.             <ul class="xoxo sidebar-list">
  43.  
  44. <?php
  45.     /* When we call the dynamic_sidebar() function, it'll spit out
  46.      * the widgets for that widget area. If it instead returns false,
  47.      * then the sidebar simply doesn't exist, so we'll hard-code in
  48.      * some default sidebar stuff just in case.
  49.      */
  50.     if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
  51.  
  52.             <li class="widget widget_search">
  53.                 <h3 class="widget-title"><?php _e( 'Search', 'pilcrow' ); ?></h3>
  54.                 <?php get_search_form(); ?>
  55.             </li>
  56.  
  57.             <li class="widget widget_recent_entries">
  58.                 <h3 class="widget-title"><?php _e( 'Recent Entries', 'pilcrow' ); ?></h3>
  59.                 <ul>
  60.                     <?php
  61.                     $recent_entries = new WP_Query();
  62.                     $recent_entries->query( 'order=DESC&posts_per_page=10' );
  63.  
  64.                     while ($recent_entries->have_posts()) : $recent_entries->the_post();
  65.                         ?>
  66.                         <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  67.                         <?php
  68.                     endwhile;
  69.                     ?>
  70.                 </ul>
  71.             </li>
  72.  
  73.             <li class="widget widget_links">
  74.                 <h3 class="widget-title"><?php _e( 'Links', 'pilcrow' ); ?></h3>
  75.                 <ul>
  76.                     <?php wp_list_bookmarks(); ?>
  77.                 </ul>
  78.             </li>
  79.  
  80.         <?php endif; // end primary widget area ?>
  81.             </ul>
  82.         </div><!-- #sidebar .widget-area -->
  83.  
  84.         <?php
  85.             /* If the current layout is a 3-column one, Pilcrow enables a second widget area called Secondary Widget Area
  86.              * This widget area will not appear for two-column layouts
  87.              */
  88.             $secondary_widget_area_layouts = array( 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar' );
  89.             if ( in_array( $current_layout, $secondary_widget_area_layouts ) ) :
  90.         ?>
  91.         <div id="secondary-sidebar" class="widget-area" role="complementary">
  92.             <ul class="xoxo sidebar-list">
  93.             <?php // A second sidebar for widgets. Pilcrow uses the secondary widget area for three column layouts.
  94.             if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?>
  95.  
  96.                 <li class="widget widget_meta">
  97.                     <h3 class="widget-title"><?php _e( 'Meta', 'pilcrow' ); ?></h3>
  98.                     <ul>
  99.                         <?php wp_register(); ?>
  100.                         <li><?php wp_loginout(); ?></li>
  101.                         <?php wp_meta(); ?>
  102.                     </ul>
  103.                 </li>
  104.  
  105.             <?php endif; ?>
  106.             </ul>
  107.         </div><!-- #secondary-sidebar .widget-area -->
  108.         <?php endif; // ends the check for the current layout that determins if the third column is visible ?>
  109.  
  110.     <?php
  111.         // add a containing div around the main sidebars for the content-sidebar-sidebar and sidebar-sidebar-layouts
  112.         // so the layout holds together with a short content area and long featured widget area
  113.         if ( in_array( $current_layout, $feature_widget_area_layouts ) )
  114.             echo '</div><!-- #main-sidebars -->';
  115.     ?>
Advertisement
Add Comment
Please, Sign In to add comment