[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/includes/ -> config.widgets.php (source)

   1  <?php
   2  
   3  // ========================
   4  // = Theme Custom Widgets =
   5  // ========================
   6  
   7  if(VPRO && class_exists('WP_Widget')){
   8  
   9      // Grand Child Navigation
  10          class PageLines_GrandChild extends WP_Widget {
  11  
  12  		   function PageLines_GrandChild() {
  13                 $widget_ops = array('description' => __( 'Creates a third tier navigation (Grandchild). Shows on pages when there are three levels; based on page heirarchy.', 'pagelines' ) );
  14                 parent::WP_Widget(false, $name = __('PageLines Pro - Grandchild Nav', 'pagelines'), $widget_ops);
  15             }
  16  
  17  		   function widget($args, $instance) {
  18                 extract( $args );
  19  
  20                  // THE TEMPLATE
  21                  global $post;
  22                  if( isset($post) && property_exists($post, 'ancestors') ) $ancestors_array = $post->ancestors;
  23                  else $ancestors_array = array();
  24  
  25                  if( isset($post) && !is_search() && ($post->post_parent && wp_list_pages("title_li=&child_of=".$post->ID."&echo=0")) || count($ancestors_array) >= 2):?>
  26                      <div id="grandchildnav" class="widget">
  27  
  28                          <div class="winner">
  29                              <h3 class="widget-title">
  30                              <?php
  31                                      if(count($ancestors_array)==1){
  32                                          $subnavpost = get_post($post->ID);
  33                                          $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&sort_column=menu_order');
  34                                      }else{
  35                                          $reverse_ancestors = array_reverse($ancestors_array);
  36                                          $subnavpost = get_post($reverse_ancestors[1]);
  37                                          $children =  wp_list_pages('title_li=&child_of='.$reverse_ancestors[1].'&echo=0&sort_column=menu_order');
  38                                      }?>
  39  
  40                                  <?php echo $subnavpost->post_title;    ?>
  41                              </h3>
  42  
  43                                  <ul>
  44                                  <?php if ($children) { echo $children;}?>
  45  
  46                                  </ul>
  47  
  48                          </div>
  49                      </div>
  50                  <?php endif;
  51  
  52             }
  53  
  54  		   function update($new_instance, $old_instance) {
  55                 return $new_instance;
  56             }
  57  
  58  		   function form($instance) {
  59                  echo '<p>' . __('There are no options for this widget.','pagelines') . '</p>';
  60             }
  61  
  62          }
  63  
  64  
  65      register_widget('PageLines_GrandChild');
  66  }


Generated: Fri Aug 30 18:26:24 2013 Cross-referenced by PHPXref 0.7.1