Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End query_posts with pagination?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #29484
    Hayley
    Member

    Hi!

    I’m using Chris’ code from the #65 screencast on Custom fields. I have a page of products listed with info being pulled from custom fields. But I can’t figure out how to paginate the list, i.e. limit the list to 10 products, then go to another page. I’d appreciate any thoughts! Is this even possible since it’s a page?

    Here’s the code:

    Code:
    10, ‘post_parent’ => 10, ‘post_type’ => ‘page’));
    while (have_posts()) {

    the_post();

    $thumbPath = get_post_meta($post->ID, ‘thumbnail’, true);
    if ($thumbPath ==”) {
    $thumbPath = ‘/images/comingsoon.png’;
    }
    ?>

    ID, ‘description’, true); ?>

    “>View this product

    #79033
    hoss9009
    Member

    This plugin works LITERALLY ANYWHERE
    http://wordpress.org/extend/plugins/wp-pagenavi/installation/

    I used it on a query loop and it works!

    #61484
    xcellenceit
    Member

    By default running query_posts will completely overwrite all existing query variables on the current page. Pagination, categories, dates etc. will be lost and only the variables you pass into query_posts will be used.

    #61336
    jacorre
    Participant

    Try something like the following:

    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($paged . "&posts_per_page=5&orderby=title&order=ASC&paged=$paged");
    ?>

    Change the arguments as needed.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.