Pagination and a Custom Post Loop
-
I have a custom post loop running for my portfolio pieces. I want to add pagination to the entries (i.e., “next project ->”, etc.).
I have tried everything and I just cannot figure out how to do it. Here is the code for my custom ‘Portfolio’ loop. If anyone can put their mind to work for me I would be overly appreciative. I have spent hours and hours troubleshooting this..
<?php /* Template Name: Portfolio */ ?> <?php include ('header-portfolio.php'); ?> <?php global $post; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $myposts = get_posts(array( 'post_type' => 'portfolio', 'numberposts' => '999', 'orderby' => 'id', 'order' => 'ASC', 'paged'=> $paged )); foreach($myposts as $post): ?> <?php setup_postdata($post) ?> <?php posts_nav_link('nextpost'); ?> <div class="thumbwrapper"> <div class="portfolio_post"> <h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?><br/><br/><?php the_excerpt('Read more...'); ?> </a></h2> <div class="portfolio_thumb"> <a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?> </a> </div> </div> </div> <?php endforeach; wp_reset_query(); ?>
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Pagination and a Custom Post Loop’ is closed to new replies.