0

I am registering a custom post type (listing) with a plugin and it has two taxonomies. It all seems to work as expected.

I can display individual posts from the CPT using single-listing.php but I can't display a full page using archive-listing.php. I just tried taxonomy-organisation.php which is the CPT taxonomy and this works too.

I am using a child theme and just used a copy of the parent archive/siingle/taxonomy pages

This is a copy of WP 2012 theme file which I named archive-listing.php:

http://pastebin.com/3BBr7eDu

This is my CPT plugin:

http://pastebin.com/btWqXDwE

This URL uses the archive.php file in the parent theme:

http://martcol.co.uk/listing/organisation/children/

5
  • 1
    Can we see the code for the post type registration, and the URL you're expecting to see the archive at? As well as any relevant information or context. Your question can't be answered if guesswork is needed to fill in the blanks, and it saves us all time if nobody has to ask for extra information
    – Tom J Nowell
    Apr 2, 2013 at 11:27
  • Sorry. I have added some further information to my question. Thanks.
    – martcol
    Apr 2, 2013 at 12:23
  • From what I can see example.com/listing/ should use archive-listing.php
    – Tom J Nowell
    Apr 2, 2013 at 12:27
  • Well, Tom, numerous online tutorials as well as WP Codex say to use archive-listing.php. I have the same plugin on the site that I am trying to work with and the above development site and neither site uses archive-listing.php. I'm stuck.
    – martcol
    Apr 2, 2013 at 12:54
  • Ah the codex makes many assumptions it doesn't always state, and can at times be a questionable resource, so don't take it as 100% accurate, more like 90% with a pinch of salt
    – Tom J Nowell
    Apr 2, 2013 at 13:23

1 Answer 1

0

Your setup would mean that archive-listing.php would be used at:

http://martcol.co.uk/listing/

However, your URL:

http://martcol.co.uk/listing/organisation/children/

Is not a post archive, it's a taxonomy archive, specifically an organisation archive, and so archive-listing.php will never be used for it, since archive-listing is not a taxonomy archive template but a post archive template.

Other than doing an include in taxonomy-organisation.php there is no way to make it call archive-listing.php, except for messing around with hooks and filters, which I strongly recommend against as it would be a waste of time and effort ( why not just include ).

I recommend looking up the template hierarchy diagram and bookmarking it

1

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.