• Resolved dali88

    (@dali88)


    I have a custom post_type => ‘products’ wich has a taxonomy => ‘product_type’ and I have a page that uses a template to display all posts by post_type => ‘products’.
    Works just fine when I create a PAGE for each post_type/taxonomy template but… I have for example a term named “furniture” (taxonomy => ‘product_type’), and I don’t want to create a page+template for each term that I’ll be adding, it’s crazy but seems to be the only way the pagination works -> on a static page.
    So, I can get the first page with the posts of the current term but in the second page forwards to search page and gives me an output with the number os posts (with that term) that I have, that number is correct but it doesn’t display my posts.
    So I’m going crazy to figure out a way to make it work, god!!
    I have custom permalinks (only the postname)…
    The path is:
    https://www.mysite.com/products/product_type/furniture/page/2
    I get: Results: 9 (9 posts – correct)

    Here is a part of my script (taxonomy-product_type.php):

    <!– GET THE TERM SLUG –>
    <?php
    if (is_tax(‘product_type’)) {
    $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) );
    $term_slug = $term->slug;
    }
    ?>

    <?php
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $args = array(
    ‘order’ => ‘DESC’,
    ‘post_type’ => ‘products’,
    ‘product_type’ => $term_slug,
    ‘posts_per_page’ => ‘8’,
    ‘caller_get_posts’ => 1,
    ‘is_paged’ => true,
    ‘paged’ => $paged );
    ?>

    <!– QUERY POSTS –>
    <?php query_posts($args); ?>
    <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>

    // featured-image, title, excerpt etc…

    <?php endwhile; ?>
    <?php endif; ?>

    <!– NAVIGATION –>
    <?php if($wp_query->max_num_pages>1) : ?>
    <div id=”nav-below” class=”navigation”>
    <?php smart_paginate(); ?> <!– SMART PAGINATION PLUGIN –>
    </div> <!– #nav-below –>
    <?php endif; ?>

    <!– RESET –>
    <?php wp_reset_query(); ?>

    I’ve seen almost all topics os taxonomy pagination, nothings works for me…
    I’m really desperate, please help…

  • The topic ‘Taxonomy Pagination’ is closed to new replies.