samikeijonen

Most Popular - Path Child

May 1st, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.27 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template Name: Most Popular
  4.  *
  5.  * @package Path
  6.  * @subpackage Template
  7.  */
  8.  
  9. get_header(); // Loads the header.php template. ?>
  10.  
  11.     <?php do_atomic( 'before_content' ); // my-life_before_content ?>
  12.  
  13.     <div id="content">
  14.  
  15.         <?php do_atomic( 'open_content' ); // my-life_open_content ?>
  16.  
  17.         <div class="hfeed">
  18.  
  19.             <?php get_template_part( 'loop-meta' ); // Loads the loop-meta.php template. ?>
  20.            
  21.             <?php if ( have_posts() ) : ?>
  22.  
  23.                 <?php while ( have_posts() ) : the_post(); ?>
  24.  
  25.                     <?php do_atomic( 'before_entry' ); // my-life_before_entry ?>
  26.  
  27.                     <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
  28.  
  29.                         <?php do_atomic( 'open_entry' ); // my-life_open_entry ?>
  30.  
  31.                         <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
  32.  
  33.                         <div class="entry-content">
  34.                             <?php the_content(); ?>
  35.                         </div><!-- .entry-content -->
  36.                        
  37.                         <?php do_atomic( 'close_entry' ); // my-life_close_entry ?>
  38.  
  39.                     </div><!-- .hentry -->
  40.  
  41.                     <?php do_atomic( 'after_entry' ); // my-life_after_entry ?>
  42.  
  43.                 <?php endwhile; ?>
  44.  
  45.             <?php else : ?>
  46.  
  47.                 <?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>
  48.  
  49.             <?php endif; ?>
  50.  
  51.             <?php
  52.                        
  53.             /* Loop for most viewed articles. entry-views extension is in use. */
  54.                        
  55.             $args = array (
  56.                 'ignore_sticky_posts' => true,
  57.                 'meta_key' => 'Views',
  58.                 'orderby' => 'meta_value_num',
  59.                 'posts_per_page' => get_option( 'posts_per_page' ),
  60.                 'paged' => ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 )
  61.             );
  62.                        
  63.             $wp_query = new WP_Query( $args );
  64.                
  65.             if ( $wp_query->have_posts() ) :   
  66.                
  67.                 while( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
  68.                        
  69.                     <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
  70.  
  71.                         <?php if ( current_theme_supports( 'get-the-image' ) ) get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'thumbnail' ) );?>
  72.  
  73.                         <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  74.  
  75.                         <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( 'Published by [entry-author] on [entry-published] [entry-comments-link before=" | "] [entry-edit-link before=" | "]', 'path-child' ) . '</div>' ); ?>
  76.  
  77.                         <div class="entry-summary">
  78.                             <?php the_excerpt(); ?>
  79.                             <?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'my-life' ), 'after' => '</p>' ) ); ?>
  80.                         </div><!-- .entry-summary -->
  81.                        
  82.                         <?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( 'Views [entry-views] [entry-terms taxonomy="category" before="Posted in "] [entry-terms before="Tagged "]', 'path-child' ) . '</div>' ); ?>
  83.                        
  84.                     </div><!-- .hentry -->
  85.                            
  86.                 <?php endwhile; ?>
  87.                
  88.                 <?php wp_reset_postdata(); // reset the query ?>
  89.            
  90.             <?php endif; ?>
  91.                        
  92.         </div><!-- .hfeed -->
  93.        
  94.         <?php do_atomic( 'close_content' ); // my-life_close_content ?>
  95.  
  96.         <?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
  97.  
  98.     </div><!-- #content -->
  99.  
  100.     <?php do_atomic( 'after_content' ); // my-life_after_content ?>
  101.  
  102. <?php get_footer(); // Loads the footer.php template. ?>
Advertisement
Add Comment
Please, Sign In to add comment