WordPress.org

Ready to get started?Download WordPress

Forums

Pagination not working (naturally) with query_posts (paged = $paged isn't it) (1 post)

  1. iftomkins
    Member
    Posted 1 year ago #

    Hi y'all! I thought I finally learned how to paginate with query_posts, but this pagination thing always throws ya for a loop.

    I'm trying to get pagination to work on a custom archive page for a custom taxonomy. I originally had it pulling in the $query_string variable. Now I have it getting the taxonomy name via another route, since I thought it might solve the pagination. No luck!

    Here's the code:

    <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $taxonomy = $term->name; ?>
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php $args = array(
    	'post_type' => 'product',
    	'taxonomy' => $taxonomy,
    	'orderby'   => 'title',
    	'posts_per_page'   => 1,
    	'paged' => $paged,
    	'order'    => 'ASC'
    );
    query_posts( $args ); ?>

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic