[ Index ]

PHP Cross Reference of PageLines DMS

title

Body

[close]

/sections/postsinfo/ -> section.php (source)

   1  <?php
   2  /*
   3      Section: Posts Info
   4      Author: PageLines
   5      Author URI: http://www.pagelines.com
   6      Description: Shows information about posts being viewed (e.g. "Currently Viewing Archives from...") Only works on pages that include multiple posts like categories, etc..
   7      Class Name: PageLinesPostsInfo
   8      Workswith: main
   9      Isolate: posts_pages
  10      Filter: component
  11  */
  12  
  13  /**
  14   * Posts Info Section
  15   *
  16   * @package PageLines DMS
  17   * @author PageLines
  18   */
  19  class PageLinesPostsInfo extends PageLinesSection {
  20  
  21      /**
  22      * Section template.
  23      */
  24     function section_template() {
  25  
  26          if( is_category() || is_archive() || is_search() || is_author() ):
  27              echo '<div class="current_posts_info">';
  28              if( is_search() ):
  29                  printf( '%s <strong>"%s"</strong>', __( 'Search results for', 'pagelines' ), get_search_query() );
  30              elseif( is_category() ):
  31                  printf( '%s <strong>"%s"</strong>', __( 'Currently viewing the category:', 'pagelines' ), single_cat_title( false, false ) );
  32              elseif( is_tag() ):
  33                  printf( '%s <strong>"%s"</strong>', __( 'Currently viewing the tag:', 'pagelines' ), single_tag_title( false, false ) );
  34              elseif( is_archive() ):
  35  
  36                  if (is_author()) {
  37                      global $author;
  38                      global $author_name;
  39                      $curauth = ( isset( $_GET['author_name'] ) ) ? get_user_by( 'slug', $author_name ) : get_userdata( intval( $author ) );
  40                      printf( '%s <strong>"%s"</strong>', __( 'Posts by:', 'pagelines' ), $curauth->display_name );
  41                  } elseif ( is_day() ) {
  42                      printf( '%s <strong>"%s"</strong>', __( 'From the daily archives:', 'pagelines' ), get_the_time('l, F j, Y') );
  43                  } elseif ( is_month() ) {
  44                      printf( '%s <strong>"%s"</strong>', __( 'From the monthly archives:', 'pagelines' ), get_the_time('F Y') );
  45                  } elseif ( is_year() ) {
  46                      printf( '%s <strong>"%s"</strong>', __( 'From the yearly archives:', 'pagelines' ), get_the_time('Y') );
  47                  } else {
  48                      if ( is_post_type_archive() )
  49                          $title =  post_type_archive_title( null,false );
  50                      if ( ! isset( $title ) ) {
  51                          $o = get_queried_object();
  52                          if ( isset( $o->name ) )
  53                              $title = $o->name;
  54                      }
  55                      if ( ! isset( $title ) )
  56                          $title = the_date();
  57                      printf( '%s <strong>"%s"</strong>', __( 'Viewing archives for ', 'pagelines'), $title );
  58                  }
  59                  endif;
  60              echo '</div>';
  61          endif;
  62      }
  63  }


Generated: Sun Dec 1 19:43:16 2013 Cross-referenced by PHPXref 0.7.1