Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter zworks

    (@zworks)

    well, i got my original coding working by just changing the ‘paged’ variable into ‘page’. But i don’t know how that works!

    Thread Starter zworks

    (@zworks)

    So this particular issue was already identified ?

    Thread Starter zworks

    (@zworks)

    As we have stated in my original question, we have a taxonomy called projectcat and we have a template file named taxonomy-projectcat.php

    And we have a term called cuisine belonging to the projectcat taxonomy.

    The custom url rewrite slug in the taxonomy settings page is renoinspiration

    So whenever we visit /renoinspiration/cuisine it loads the taxonomy-projectcat.php template and shows fine, means it shows the 8 posts, because we do the query as following:

     $paged = (get_query_var('page')) ? get_query_var('page') : 1;
                $wp_query = new WP_Query();
                $wp_query->query(array(
                'post_type'=>'projects',
                'paged' => $paged,
                'posts_per_page' =>8,
                ));
               	  
                  $args_page = array('post_type' => 'projects', 'tax_query' => array(array('taxonomy' => 'projectcat', 'field' => 'id','terms' => $term_id)), 'post_status' => 'publish', 'order' => 'DESC',  'posts_per_page' => 8, 'paged' => $paged,  'total' => $wp_query->max_num_pages);
                  $loop = new WP_Query( $args_page );

    And at the end we have the following:

    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
    				<div class="alignright"><?php previous_posts_link('Next Entries &rarr;') ?></div>
    		        <div class="alignleft"><?php next_posts_link('&larr; Previous Entries') ?></div>
    		        
    		        <?php } ?>

    If we have more than 8 posts of this type, it’s fine on the 1st page and displays the pagination correctly, but when we click on the other links on the pagination we get a 404.

    We really appreciate your time!

    • This reply was modified 8 years, 4 months ago by zworks.
    Thread Starter zworks

    (@zworks)

    Well, if i understand correctly, i think the link you provided mainly focuses on how to do a clean pagination, but my issue is not with generating the pagination, the pagination links are already generated correctly and exactly how it should be, but when we click the 2nd page or other pages it gives a 404 error.

    In the rewrite rule, it works fine only when there is no ‘paged’ variable, but if we add the ‘paged’ variable then it gives the 404 error.

    Thread Starter zworks

    (@zworks)

    yes, every time i change change/add rewrite rules i flush the rewrite rules.

Viewing 5 replies - 1 through 5 (of 5 total)