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.

i have a site (http://fashionlog.com.br) with a custom post type 'fotolog' as you can see on the right side.

The posts and pagination of the blog (central column) work fine. But when it comes to the posts and pagination of my CPT it goes wrong.

If i dont use the flush_rewrite_rules( false ); function after my register_post_type() call in functions.php, i can see the posts but the pagination doesnt work. If a use the function it's the oposite, i can't see the posts (404) but i get the pagination!

I've been trying lots of times to switch the permalinks structure for tests, i checked my .htaccess file and its permissions, i tryed to "play" with the 'rewrite' parameter of the register_post_type() function, i've read and tryed the solution written here, here and also here... So far no luck, or am i missing something super obvious?

I'd really be grateful for some help.

share|improve this question
    
What's your query for getting the posts? It could be that you don't have paged set in your query like so: query_posts('post_type=fotolog' . '&paged=' . get_query_var('paged')); ...Also, make sure you don't have a page and a post type with the same permalink like /fotolog and /fotolog/your-post-name-here –  eileencodes Dec 30 '10 at 18:19
    
Dude you're the man! Yeah i had a cpt 'fotolog' and a page named 'fotolog'! Big thanks. –  kevin Dec 30 '10 at 19:41
    
Glad I could help, I'm moving my comment to answers so you can mark the question as answered :) –  eileencodes Dec 30 '10 at 20:28
2  
Big time flag here: NEVER run flush_rewrite_rules() like you say you are. flush_rewrite_rules() is an extremely expensive process that shouldn't be done any more than is necessary. If you need to flush the rules just visit WP-Admin -> Settings -> Permalinks. It'll flush the rewrite rules for you. Doing this once is all that's necessary until you do something that changes the rules again (e.g. registering more taxonomies or CPTs). –  John P Bloch Dec 30 '10 at 20:39
    
Yeah i learned that by reading lots of things about it. –  kevin Jan 3 '11 at 12:26
add comment

1 Answer

up vote 2 down vote accepted

Make sure your query has paged in it like so:

query_posts('post_type=fotolog' . '&paged=' . get_query_var('paged'));

Check to be sure that you don't have page and a post type with the same permalink /foflog and /fotolog/your-post-name-here

share|improve this answer
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.