I have code in my header that excludes certain templates. I need to change it to also exclude an archive page for my Custom Post type. The file name for the archive template is taxonomy-press_category.php
.
But I don’t know how to also include my custom post type archive template.
I am currently using:
if ( ! is_page_template ( array( 'homepage_template.php', 'services_template.php') ) )
2
Answers
Thank you so much for your references, that helped.
This is the code that finally worked for me:
I highly recommend reading the "Docs" first. It’ll help you get your question answered quicker!
To exclude an archive page you could use
!is_archive()
and!is_post_type_archive()
. To include it, then remove the!
.and
Since you mentioned something about taxonomy, although it was not clear,
is_tax()
could be another conditional check that might be useful.Again I highly recommend reading the "Docs", or at least, include the details of your problem in a clear way so that people could help you faster.