Advertisement
Smartik

Post type "photo" index

Aug 8th, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.     $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : ( get_query_var( 'page' ) ? get_query_var( 'page' ) : 1 );
  3.     $args  = array(
  4.         'post_type'           => 'photo',
  5.         'post_status'         => 'publish',
  6.         'paged'               => $paged,
  7.         'posts_per_page'      => 8,
  8.         'ignore_sticky_posts' => 1
  9.     );
  10.  
  11.     $photo_query = new WP_Query( $args );
  12.  
  13. // Posts start
  14. if ( $photo_query->have_posts() ) :
  15.    
  16.     while ( $photo_query->have_posts() ) :
  17.         $photo_query->the_post(); ?>
  18.        
  19.         <!-- One post -->
  20.         <div class="entry">
  21.             <h2 class="title"><?php the_title(); ?></h2>
  22.         </div>
  23.  
  24.     <?php endwhile; ?>
  25.  
  26.     <!-- Pagination -->
  27.     <div class="navigation">
  28.         <div class="alignleft"><?php next_posts_link('ยซ Older Entries') ?></div>
  29.         <div class="alignright"><?php previous_posts_link('Newer Entries ยป') ?></div>
  30.     </div>
  31.  
  32. <?php else : ?>
  33.  
  34.     <h2>Not Found</h2>
  35.     <p>Sorry, but you are looking for something that isn't here.</p>
  36.  
  37. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement