Pagination for custom post type
-
I am using custom post type with my blog. Everything is working fine but having problem in pagination. I set 10 post to home page & now I have 15 post. When I click on Older Entry, nothing display without 404 error. My custom post template code is-
[ Moderator note: Code fixed. Please don’t mix blockqoute with the code button or backticks, you get odd results that ways. the code below is corrupted with paragraph and line-break tagss.]
</p> <p><div id="content"></p> <p><?php<br /> $temp = $wp_query;<br /> $wp_query= null;<br /> $wp_query = new WP_Query();<br /> $wp_query->query('post_type=recipes'.'&paged='.$paged);<br /> ?><br /> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> </p> <p><div class="post clearfix" id="post-<?php the_ID(); ?>"><br /> <?php<br /> if ( has_post_thumbnail() ) { ?><br /> <a>"><img class="postimg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=200&w=200&zc=1" alt=""/></a><br /> <?php } else { ?><br /> <a>"><img class="postimg" src="<?php bloginfo('template_directory'); ?>/images/dummy.jpg" alt="" /></a><br /> <?php } ?><br /> <div class="cover"><br /> <div class="title"><br /> <h2><a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><br /> </div><br /> <div class="recipemeta"><br /> <span class="cooktime"> Cooking time: <?php $cooktime=get_post_meta($post->ID, 'wtf_cooktime', true); echo $cooktime; ?> mins </span> <span class="serve"> Serving: <?php $serving=get_post_meta($post->ID, 'wtf_serving', true); echo $serving; ?> people</span><br /> </div><br /> <div class="entry"><br /> <?php wpe_excerpt('wpe_excerptlength_recipe', ''); ?><br /> <div class="clear"></div><br /> </div><br /> </div><br /> </div></p> <p><?php endwhile; ?></p> <p><div class="clear"></div></p> <p><?php getpagenavi(); ?></p> <p><?php $wp_query = null; $wp_query = $temp;?></p> <p></div></p> <p>
Please help!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Pagination for custom post type’ is closed to new replies.