tribe_is_events_front_page()
Tests if we are on the site homepage and if it is set to display the main events page.
As WordPress front page it might be different from is_home, if we have a front page on the reading options and if the User is on that page, this function will return true otherwise will return false. So either if the User has the frontpage set on the reading options and the User is visiting this page.
Another consideration about this is it might behave as a WordPress function which means after any Ajax action is fired the result of call this function via Ajax might not be the expected result so ideally can be used to test if you are on the front page on first load of the page only.
Return
(bool)
Source
File: src/functions/template-tags/general.php
function tribe_is_events_front_page() {
$wp_query = tribe_get_global_query_object();
$events_as_front_page = tribe_get_option( 'front_page_event_archive', false );
// If the reading option has an events page as front page and we are on that page is on the home of events.
return (
$wp_query->is_main_query()
&& $events_as_front_page
&& $wp_query->tribe_is_event
&& true === get_query_var( 'tribe_events_front_page' )
);
}
Changelog
| Version | Description |
|---|---|
| 4.6.9 | Introduced. |