本文整理汇总了PHP中WPSEO_Frontend::is_home_static_page方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Frontend::is_home_static_page方法的具体用法?PHP WPSEO_Frontend::is_home_static_page怎么用?PHP WPSEO_Frontend::is_home_static_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Frontend
的用法示例。
在下文中一共展示了WPSEO_Frontend::is_home_static_page方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_is_home_static_page
/**
* @covers WPSEO_Frontend::is_home_static_page
*/
public function test_is_home_static_page()
{
// on front page
$this->go_to_home();
$this->assertFalse(self::$class_instance->is_home_static_page());
// on front page and show_on_front = page
update_option('show_on_front', 'page');
$this->assertFalse(self::$class_instance->is_home_static_page());
// create page and set it as front page
$post_id = $this->factory->post->create(array('post_type' => 'page'));
update_option('page_on_front', $post_id);
$this->go_to(get_permalink($post_id));
// on front page, show_on_front = page and on static page
$this->assertTrue(self::$class_instance->is_home_static_page());
// go to differen post but preserve previous options
$post_id = $this->factory->post->create();
$this->go_to(get_permalink($post_id));
// options set but not on front page, should return false
$this->assertFalse(self::$class_instance->is_home_static_page());
}