custom post pagination
-
I have the following code when however the next posts and the previuos posts links doesn’t show on the page.
<?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $product_posts = new WP_Query( array ( 'post_status' => 'publish', 'post_type' => 'product', 'post_per_page' => 2, 'paged' => $paged ) ); if( $product_posts->have_posts() ) : while( $product_posts->have_posts() ) : $product_posts->the_post(); ?> <div id="products"> <div class="center"> <div class="product-title"> <?php the_title(); ?> </div> <!-- product-title --> <div class="product-image"> <?php if( has_post_thumbnail() ) { set_post_thumbnail_size( 200 ); the_post_thumbnail(); } ?> </div><!-- product-image --> <div class="price"> <b>Price: </b><?php echo get_post_meta( get_the_ID(), 'price_text', true ); ?> </div><!-- price --> <div class="float-right"> <?php $stock_meta = get_post_meta( get_the_ID(), 'stock_text', true ); if( $stock_meta > 0 ) { echo '<span class="in-stock">In stock</span>'; } if( $stock_meta <= 0 ) { echo '<span class="out-of-stock">Out of stock</span>'; } ?> </div><!-- float-right --> </div><!-- center --> </div> <!-- products --> <?php endwhile; endif; ?> <div class="clear-both"></div><!-- clear-both --> <div class="alignleft"><?php previous_posts_link('« Previous') ?></div> <div class="alignright"><?php next_posts_link('More »') ?></div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘custom post pagination’ is closed to new replies.