Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Finally got pagination to work with the below code, but now the pagination links to /videos/page/2/, which doesn't exist. How do I get page 2 to work?

<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('post_type=videos&showposts=1'.'&paged='.$paged);

while ($wp_query->have_posts()) : $wp_query->the_post();
  //display stuff
endwhile;           

php  wp_pagenavi();
 ?>
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Found the answer:

After a looong day debugging thru wordpress core, I managed to solve this issue.

Basicly, you CANT have a PAGE and a CUSTOM POST TYPE with the same name. If you do, the permalink rewrite rules will get confused and trigger a 404.

A very simple solution I'm using is: The page that lists the custom post types is called in plural (eg. products) and the actual post type name is in singular (eg. product). So they dont conflict and it's all fine.

Done Done! Hope this will save people's time.

share|improve this answer
2  
I guess, not just custom post, you can't have a post and a page with the same name as well. –  Rutwick Gangurde Mar 6 '12 at 3:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.