本文整理汇总了PHP中WP_Customize_Manager::has_published_pages方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::has_published_pages方法的具体用法?PHP WP_Customize_Manager::has_published_pages怎么用?PHP WP_Customize_Manager::has_published_pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Customize_Manager
的用法示例。
在下文中一共展示了WP_Customize_Manager::has_published_pages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/**
* Ensure that page stubs created via nav menus will cause has_published_pages to return true.
*
* @ticket 38013
* @covers WP_Customize_Manager::has_published_pages()
*/
function test_has_published_pages_when_nav_menus_created_posts()
{
foreach (get_pages() as $page) {
wp_delete_post($page->ID, true);
}
$this->assertFalse($this->manager->has_published_pages());
wp_set_current_user(self::$admin_user_id);
$this->manager->nav_menus->customize_register();
$setting_id = 'nav_menus_created_posts';
$setting = $this->manager->get_setting($setting_id);
$this->assertInstanceOf('WP_Customize_Filter_Setting', $setting);
$auto_draft_page = $this->factory()->post->create(array('post_type' => 'page', 'post_status' => 'auto-draft'));
$this->manager->set_post_value($setting_id, array($auto_draft_page));
$setting->preview();
$this->assertTrue($this->manager->has_published_pages());
}