Support » How-To and Troubleshooting » CPT Portfolio Pagination Not Working

CPT Portfolio Pagination Not Working

  • Hi, I am trying to get the pagination of my Custom Post Type Portfolio to work and everytime I click on “Next Page”, the same 9 items appear.. Any suggestions? Below is a watered down version of my template.

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		$title= str_ireplace('"', '', trim(get_the_title()));
    		$desc= str_ireplace('"', '', trim(get_the_content()));
    				<div class="img"><a title="<?php echo $title ?>: <?php echo $desc ?>" rel="lightbox[work]" href="<?php print  portfolio_thumbnail_url($post->ID) ?>"><?php the_post_thumbnail(); ?></a></div>
    				<h2><?php echo $title ?></h2> <p><?php print get_the_excerpt(); ?></p>
    				<?php $site= get_post_custom_values('projLink');
    					if($site[0] != ""){
    				<?php }else{ ?>
    				<?php } ?>
    <?php endwhile; endif; ?>
    <?php posts_nav_link(); ?>
    <?php get_footer(); ?>

    Tried various things and just couldnt get it to work..

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator keesiemeijer


    thanks but I tried all of that prior to posting, still no luck..

    Moderator keesiemeijer


    So you tried it with the paged parameter?

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('post_type=portfolio&posts_per_page=9&paged=' . $paged);

    Ya I had tried that with no luck… Here is the pastebin of anything and everything that I am using with it.. Maybe someone notices something I’m failing to do.


    So I got the pagination to work… kinda

    Now it does indeed go to next and previous but wont go past the 2nd page without giving an error 404.. I know there should be things on the third page yet when I try to access it I get the 404 message. Not only that but I have lost my taxonomy. I have the CPT Portfolio broken down into sections like Graphic Design, Web Design, Etc. But when I click on web design I get stuff from the graphic design category, and etc.

    Anyone know why this might have happened or a possible fix?

    Turns out I was making a mistake when I added the paged parameter so I used keesie’s example above and that is how I am where I am now..

    Can someone help me with this? I am trying to register my taxonimies for this CPT Portfolio.. I want to add things to my menu to keep them organized like Web Design Portfolio, Graphic Design Portfolio, Etc. However if I add the Web Design Category for the CPT to my menu then it shows me all portfolio pieces instead of just web design, or just graphic design..

    I have gotten this far but still cant get it to work

    $projtype = strip_tags(get_the_term_list($post->ID, $tax));
    $tax = get_taxonomies();
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('taxonomy=' . $projtype . '&post_type=portfolio&posts_per_page=12&paged=' . $paged);


Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘CPT Portfolio Pagination Not Working’ is closed to new replies.