×

php up to date

Wordpress custom posts page with Pagination

Wordpress custom posts page with Pagination 


<?php 

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 5, 'paged' => $paged );
query_posts($args); 

?>
<?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
        <?php get_template_part( 'content', get_post_format() ); ?>
    <?php endwhile; ?>

<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>

<?php endif; ?>
SHARE

blogger

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Thanks for your valuable feedback