本文整理汇总了PHP中WPSEO_Frontend::author方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Frontend::author方法的具体用法?PHP WPSEO_Frontend::author怎么用?PHP WPSEO_Frontend::author使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Frontend
的用法示例。
在下文中一共展示了WPSEO_Frontend::author方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_author
/**
* @covers WPSEO_Frontend::author
*/
public function test_author()
{
$this->assertFalse(self::$class_instance->author());
// create and go to post
$author_id = $this->factory->user->create(array('role' => 'administrator'));
$post_id = $this->factory->post->create(array('post_author' => $author_id));
$this->go_to(get_permalink($post_id));
// post type default not set
$this->assertFalse(self::$class_instance->author());
// post type default set but author meta not set
self::$class_instance->options['noauthorship-post'] = false;
$this->assertFalse(self::$class_instance->author());
// post author meta, but not set
WPSEO_Meta::set_value('authorship', 'always', $post_id);
$this->assertFalse(self::$class_instance->author());
// set author meta
$gplus = 'https://plus.google.com/+JoostdeValk';
add_user_meta($author_id, 'googleplus', $gplus);
$expected = '<link rel="author" href="' . esc_url($gplus) . '"/>' . "\n";
// post author meta and user meta set
$this->assertTrue(self::$class_instance->author());
$this->expectOutput($expected);
// post type default and user meta set
WPSEO_Meta::set_value('authorship', '-', $post_id);
$this->assertTrue(self::$class_instance->author());
$this->expectOutput($expected);
}