WordPress.org

Ready to get started?Download WordPress

Forums

CPT Portfolio Pagination Not Working (7 posts)

  1. DesignLoud
    Member
    Posted 1 year ago #

    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
    get_header(); 
    
    query_posts('post_type=portfolio&posts_per_page=9');
    
    ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	<?php
    		$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..

  2. keesiemeijer
    moderator
    Posted 1 year ago #

  3. DesignLoud
    Member
    Posted 1 year ago #

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

  4. keesiemeijer
    moderator
    Posted 1 year ago #

    So you tried it with the paged parameter?

    <?php
    get_header(); 
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('post_type=portfolio&posts_per_page=9&paged=' . $paged);
    ?>
  5. DesignLoud
    Member
    Posted 1 year ago #

    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.

    http://pastebin.com/AaZ4RRxW

  6. DesignLoud
    Member
    Posted 1 year ago #

    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..

  7. DesignLoud
    Member
    Posted 1 year ago #

    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);

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic