Ok, so I still can’t figure out the best way to check if the returned post is the static front page (without getting and comparing the url). However, I figured out how to check if a returned item is using a specific page template using get_page_template_slug(). I didn’t know that function existed before running into this issue. Luckily my front page is using a custom page template, so don’t currently need a work around for is_front_page().
So where I would usually use is_page_template(‘templates/template-name.php’) I was able to check using the following:
$id = get_the_ID();
$template_slug = get_page_template_slug( $id );
if( $template_slug === 'templates/template-name.php' ) :
do stuff
endif;
Related Posts:
- A search for ‘0’ returns results
- If No Search Results, Show Posts from Alternate Search Query
- Custom search form to display users only
- How to get an array of years from all of the search results, and use it to filter by year the paginated loop?
- How to go about combining dropdowns / filter queries?
- Get search.php results in header.php?
- Filter the_posts doesn’t work on search page
- How to modify search.php to not show pages only show posts
- Include future posts in tags and in search
- Search page loop banner image issue
- Does search.php autofilter The Loop?
- How do I set the Stewart Search Template to return only published posts in the result
- Trying to get all links in my posts
- Search – Check if post is a page on search page
- Eliminate duplicates in a foreach loop [closed]
- Jquery Slider for profile template
- Get excerpt using get_the_excerpt outside a loop
- Should I use loop in the single.php file?
- how to upload image using wp_handle_upload
- Avoiding using a loop to access a single post
- Adding ‘current_post_item’ class to current post in the loop
- wp_list_categories: get latest featured_image of category
- WordPress Alphabetical Glossary close div in loop
- Landing Page – Redirect Loop?
- How to make multiple Column in archive Page?
- Sort Popular Posts by Views for the Last Week
- category__not_in — anyway to use category name instead of id?
- Filtering posts by multiple taxonomies
- Is it possible to display previous post revision?
- Make a custom loop inside single.php with pagination
- Why do I get `Call to a member function have_posts() on a non-object `? [closed]
- Help with Changing loop.php?
- Adding shortcode closing tag after a loop
- Differentiate between posts and pages in search results
- Removing the_content() from the page
- How to split a loop into two columns
- Category Ajax call
- Change front-page layout after x amount of posts ( while in the same loop)
- Transient loop issue
- popular post weekly and monthly
- How can i use the same template file with a widget and category loop?
- WordPress Loop inside Loop?
- Filter the loop by categories using checkbox form
- Duplicated posts on category page
- WordPress loop: exclude if it is the latest post
- What to and how to proceed with CPT to make DB small and efficient?
- angularjs not displaying all posts
- query_posts() vs get_posts() multiple loops [duplicate]
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- ACF custom field in [closed]
- Split wordpress loop to multiple layouts
- How do I make a variable available inside partials?
- Update status of all posts in a category
- is_active-sidebar loop
- Unable to change the “Read more” text inside the_excerpt
- Display Post Author Link above the loop
- Enabling users to control custom loop’s query
- Conditional: IF current user has NOT commented on current post (not including post author)
- How to add add more properties to WP_Post object in search results loop
- Change post order by meta key, per post basis
- Loop Problem: Displays same set of post for all categories
- Query Nopaging action not having effect
- display post format text in loop
- How do i find and restore a sidebar that i accidentally deleted? [closed]
- Posts not showing
- Inserting CPT and static content at every X post, is this possible?
- Use BuddyPress data in loop (mkdir)
- Wrap every four posts within a div [duplicate]
- Get most recent post for every term in a given taxonomy type
- loop through posts and display inserted media and post title as a link
- using update_user_meta to rank users
- Can’t grab author info outside of the loop
- How to tell if all posts are only in one category?
- How to get post category and author name for cusmot API?
- WordPress posts in the loop not stacking side by side
- How to separate post titles with a comma in the loop?
- Trying to get property ‘post_content’ of non-object
- WordPress loop : how to exclude some posts with their status?
- Slug is changing when I use WP_Query in a metabox of a post
- How to execute a user loop with shortcode
- how to get author comment inside the loop?
- How to create loop in custom page, and get id from url into this loop?
- Custom loop not working in singular.php, working in other pages
- Loop Posts Outside of WordPress Installation
- Strange problem with wp_get_attachment_image_src database (db) query count
- How to include posts from one category, into a separate category of posts?
- how do i make this loop work
- Making a specific page wordpress compatable that is not index
- Display single post inside accordion based on form submission results
- change the_content images for different sizes (Desktop, tablet, mobile)?
- Building theme so user can change header image [closed]
- display only parent replies count in index.php
- using the loop on a page
- Tag custom loop show posts
- While loop inside another while loop
- loop mix my child-category and parent-category
- Fix html inside a for loop [closed]
- Display all posts in a page code for template
- Insert multiple custom components after x-number of posts
- Use Base-URL with Query-Loop