0

This may be a weird scenario, but...I have a custom post type called Resources. When visiting /resources/ I get the archive as expected. What I want is a text describing this post type. Therefore I've made a page with the exact name and path. If I now go to /resources/ I still get the archive page, which is good. So, I created a custom template (archive-resources.php) and from there I searched pages with the same path and then I find my page and is able to write out the text before listing the archive.

What I want to know is that, is this a good way to solve my problem? if not, how can I make it better?

4
  • I'm not sure why you need/want to introduce a static Page into this scenario at all. Is there any problem with merely using archive-resources.php to display the "Resources" archive index, with descriptive text? Commented Jan 24, 2012 at 16:05
  • Well the problem is that you can't set a description for a post type. I'm not going to hard code it in the template for obvious reasons.
    – tbleckert
    Commented Jan 25, 2012 at 14:04
  • What are the "obvious reasons" for not hard-coding a custom post-type specific description into a custom post-type specific template file? Commented Jan 25, 2012 at 14:07
  • First, my site is multilingual, long texts like that shouldn't be translated that way. Second, I'm not the editor and I'm pretty sure the easiest way for the editor to change that text is to do it in the admin.
    – tbleckert
    Commented Jan 26, 2012 at 10:44

1 Answer 1

2

I don't see anything wrong with using archive-$cpt_name.php as your default archive page for the custom post type. That would be the correct way to go about doing it. Although there are many different methods to do it, I think you are on the right track to the best way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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