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'm trying to set up a new CPT called news (see code here: http://pastie.org/3148081) and I'm specifying the has_archive parameter.

I've set up a new template called archive-news.php and single-news.php but its not being used when I go to /news/ or the permalink on the site. Instead the default archive.php and single.php gets loaded.

I've flushed the rewrite rules but still does not work.

This is the first time I'm using the has_archive parameter but after lots of searching I still can't see what I doing wrong.

Hopefully it's just a stupid mistake somewhere that someone can spot for me.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Your custom post type is je_news. This means that your single and archive files should be called single-je_news.php and archive-je_news.php.

The has_archive option enables you to change the archive url, but it doesn't override what the templates should be named.

share|improve this answer
    
Thanks @VelvetBlues I just realised this myself and posted at the same time as you! –  Johannes Jan 8 '12 at 12:32
add comment

Ok feeling really stupid now!! I had used the following when registering the post type

register_post_type( 'je_news' , $args );

But named the archive file archive-news.php obviously it should be archive-je_news.php.

All working now.

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.