Support » Fixing WordPress » Pagination on custom post types not working for search, archive etc…

  • I’ve managed to get pagination working for custom post types called ‘recipes’ with the WP-Paginate plugin using the following code:

    <?php  query_posts( 'post_type=recipes&posts_per_page=6&paged='.$paged );
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    // code goes here
    
    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>

    Unfortunately for search.php and taxonomy.php pagination isn’t working.

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    // loop through search results
    
    <?php endwhile; ?>	
    
    <?php if(function_exists('wp_paginate')) {
        wp_paginate();
    } ?>

    Is there some way I can add the ‘paged’ and ‘posts_per_page attributes on these pages?

  • The topic ‘Pagination on custom post types not working for search, archive etc…’ is closed to new replies.