Detect if current page is front page within custom query

Illustration: Checking if active page is frontpage or search in custom loops using site-wide template parts

I am currently working on a project where we’re designing a custom frontpage template for a static front page.

Within the template are three different custom WP_Queryies with relating loops. Within one of the custom loops, I use template-parts chosen by which post type the current post is. In these template parts (meaning within a custom loop), I would like to check if the current page (active page, meaning “frontpage” where the loop lives, not the current active element in the custom loop) is frontpage or search results page to display an icon for identifying different post types.

If my understanding of the descriptions of is_search and is_front_page is correct, these functions checks current element in loop, hence will they do me no good in this particular example.

An illustration is provided to assist the description above.

Does anyone have a good idea on how to check if the active page is the front page or the search results page in the custom loop?

Read more here: Detect if current page is front page within custom query

Leave a Reply

Your email address will not be published. Required fields are marked *