0

I'm in the process of making few changes to the header of my secondary pages, but I need to identify whether my page is an archive page, and if it is a CPT archive page or not.

Is there something quick I can use= Thanks

  • You can spit out the post global $post; echo $post->post_type; or if you're in a loop you can just say echo $post->post_type – Howdy_McGee May 7 '14 at 18:49
2

The aptly named is_post_type_archive() seems to be what you need, or perhaps that plus is_archive() depending on exactly what you are trying to do.

  • Don't forget is_home() for Posts archive. – Eric Holmes May 7 '14 at 19:01
  • What's the point to use the is_home in this context? – Andrea Moro May 7 '14 at 20:41
  • @AndreaMoro : it may or may not be useful. That depends on the context, which you have explained only minimally. – s_ha_dum May 7 '14 at 20:44

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.