1

I would like to detect following pages:

http://192.168.1.100/wordpress/?m=201311 - blog archive

http://192.168.1.100/wordpress/?cat=1 - blog category

For example, post type I can easly detect with:

$page_id = get_queried_object_id();

if (get_post_type( $page_id ) != 'slideshow')

How about the above pages ? I mean any category or archive page.

1 Answer 1

3

There are Conditional Tags for this: is_archive() and is_category() respectively. For a custom post type archives you could use is_post_type_archive(). There are many conditional tags available, see above linked codex page. To determine the blog archive you have to additionally check for the post type post, take a look at this question and the answers for more useful information.

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.