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 sorry if my question may seem strange, but I've only recently started fiddling with WordPress development, as I was given a project already largely developed (I'm not saying it was well developed ;-) ).

The previous developer registered several post types, and assigned custom fields to each post type. For instance, there is a "news" post type, whose "section" custom field can be "updates" or "press review". However, this was left behind, and only a archive-news.php and a single-news.php scripts have been written to present the list of "updates" and the single "update".

Now I need to keep the current contents of the existing pages, but I have to make a new page listing the "news" posts with section set to "press review". I think I've got how to query and how to present the posts, but what I'm missing is how can I point to the new "archive-pressreview.php" page. From what I got, it would be easy to do if "press review" was a post type, but it's not, and I cannot change it.

How could I get a permalink to my custom archive page?

Thanks in advance!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

WordPress does not support a template file which queries custom fields. You can reference the template file hierarchy.

One option would be to make a page for the news archive and a custom page for the press review archive. From these pages you could make custom template files to override the page:

page-press-reviews.php
page-news.php

These pages could leverage the query code you've already written. Unfortunately the default template tags to link to these pages won't work but you can link directly to these individual pages.

It's a little bit of a hack but it'll get you there.

share|improve this answer
    
Thanks @infamouse - it's definitely not a solution, but it may be the hack I need. –  Simone Jun 17 at 7:58

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.