Main Issue: I can't use Wordpress conditional checks (is_page(), is_front_page() and is_page_template()) inside the main loop of my search.php file.
I know the Codex states that is_page() and other conditional checks don't work in the loop. So trying to figure out work arounds.
Objective: I'm using Advanced Custom Fields for all content entered on the homepage and some other templates, not using the default page editor at all. When someone searches, I want each returned item to have the featured image (post thumbnail), title, permalink and descriptive text that has been entered into a ACF field since I can't use the_content() or the_excerpt().
So inside the loop for my search.php, I'm doing some checks to see what post type/page the returned item is, or what template is being used so I can retrieve the appropriate content.
I was able to use 'page' == get_post_type() as a alternative to where I would normally use is_page(). I just can't figure out how to check if its the front page or if it's a page using a specific template. As I mentioned is_front_page() and is_page_template() do NOT work inside the main loop.
I also cannot use a page's name to check, as the page name for home (static front page) could change once the I turn it over to my client and they start creating real content. And obviously the template can be used on multiple pages which I won't know the names of until after the client creates them. I'm looking for a better long term solution that can handle any page created by the client in the future.
While any help is greatly appreciated, all I ask is please do not recommend a plugin for this, I want to accomplish this programmatically.
Thanks in advance!