WP_Customize_Manager::has_published_pages()
Returns whether there are published pages.
Used as active callback for static front page section and controls.
Метод класса: WP_Customize_Manager{}
Хуков нет.
Возвращает
true|false
. Whether there are published (or to be published) pages.
Использование
$WP_Customize_Manager = new WP_Customize_Manager(); $WP_Customize_Manager->has_published_pages();
Список изменений
С версии 4.7.0 | Введена. |
Код WP_Customize_Manager::has_published_pages() WP Customize Manager::has published pages WP 6.6.2
public function has_published_pages() { $setting = $this->get_setting( 'nav_menus_created_posts' ); if ( $setting ) { foreach ( $setting->value() as $post_id ) { if ( 'page' === get_post_type( $post_id ) ) { return true; } } } return 0 !== count( get_pages( array( 'number' => 1, 'hierarchical' => 0, ) ) ); }