Yoast\WP\SEO\Helpers
Current_Page_Helper::is_home_posts_page()
Determine whether this is the homepage and shows posts.
Метод класса: Current_Page_Helper{}
Хуков нет.
Возвращает
true|false
. Whether or not the current page is the homepage that displays posts.
Использование
$Current_Page_Helper = new Current_Page_Helper(); $Current_Page_Helper->is_home_posts_page();
Код Current_Page_Helper::is_home_posts_page() Current Page Helper::is home posts page Yoast 24.6
public function is_home_posts_page() { $wp_query = $this->wp_query_wrapper->get_main_query(); if ( ! $wp_query->is_home() ) { return false; } /* * Whether the static page's `Homepage` option is actually not set to a page. * Otherwise WordPress proceeds to handle the homepage as a `Your latest posts` page. */ if ( (int) \get_option( 'page_on_front' ) === 0 ) { return true; } return \get_option( 'show_on_front' ) === 'posts'; }