1

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.

2

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.

  • Thanks @VelvetBlues I just realised this myself and posted at the same time as you! – Brigante Jan 8 '12 at 12:32
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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