WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Query::is_front_page() WP 3.1.0

Is the query for the front page of the site?

This is for what is displayed at your site's main URL.

Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'.

If you set a static page for the front page of your site, this function will return true when viewing that page.

Otherwise the same as @see WP_Query::is_home()

Это метод класса: WP_Query

Хуков нет.


true/false. True, if front of site.


$WP_Query = new WP_Query();
$var = $WP_Query->is_front_page();

Список изменений

С версии 3.1.0 Введена.

Код WP Query::is front page: wp-includes/class-wp-query.php WP 5.4.2

public function is_front_page() {
	// Most likely case.
	if ( 'posts' == get_option( 'show_on_front' ) && $this->is_home() ) {
		return true;
	} elseif ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) {
		return true;
	} else {
		return false;