本文整理匯總了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());
}