WordPress.org

Ready to get started?Download WordPress

Forums

Post pagination (2 posts)

  1. bondigor69
    Member
    Posted 10 months ago #

    Hey guys I have this code that shows recent posts

    <ul>
        <?php $the_query = new WP_Query( 'showposts=10' ); ?>
    
        <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
        <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    
        <li><?php the_content(__('(moreā€¦)')); ?></li>
        <?php endwhile;?>
        </ul>

    I want to paginate this with this code

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    query_posts('posts_per_page=3&paged=' . $paged);
    ?>

    How can I combine it

    Please.

  2. bondigor69
    Member
    Posted 10 months ago #

    sorry

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    query_posts('posts_per_page=10&paged=' . $paged);
    ?>

Reply

You must log in to post.

About this Topic