Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2. // set the "paged" parameter (use 'page' if the query is on a static front page)
  3. $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
  4.  
  5. // the query
  6. $blog = new WP_Query( 'cat=1&paged=' . $paged );
  7. ?>
  8.  
  9. <?php if ( $blog->have_posts() ) : ?>
  10.     <ul id=\"internal-landing\">
  11.     <?php
  12.     // the loop
  13.     while ( $blog->have_posts() ) : $blog->the_post();
  14.     ?>
  15.         <li class="blog-landing">
  16.         <h2><?php the_title(); ?></h2>
  17.         <p><?php the_content(); ?</p>
  18.         </li>
  19.     <?php endwhile; ?>
  20.     </ul>
  21.     <?php
  22.  
  23.     // get_next_posts_link() usage with max_num_pages
  24.     echo get_next_posts_link( 'Older Entries', $blog->max_num_pages );
  25.     echo get_previous_posts_link( 'Newer Entries' );
  26.     ?>
  27.  
  28.     <?php
  29.     // clean up after our query
  30.     wp_reset_postdata();
  31.     ?>
  32.  
  33.     <?php else:  ?>
  34.     <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
  35.     <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement