本文整理汇总了PHP中get_the_author_posts函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_author_posts函数的具体用法?PHP get_the_author_posts怎么用?PHP get_the_author_posts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_author_posts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_get_the_author_posts
function test_get_the_author_posts()
{
// Test with no global post, result should be 0 because no author is found
$this->assertEquals(0, get_the_author_posts());
$GLOBALS['post'] = $this->post_id;
$this->assertEquals(1, get_the_author_posts());
}
示例2: wp_about_author_display
function wp_about_author_display($for_feed = false)
{
global $post;
$wp_about_author_settings = array();
$wp_about_author_settings = get_option('wp_about_author_settings');
$wp_about_author_content = "";
$wp_about_author_links = "";
$wp_about_author_social = "";
$wp_about_author_author_pic = "";
$wp_about_author_author = array();
$wp_about_author_author['name'] = get_the_author();
$wp_about_author_author['description'] = get_the_author_meta('description');
$wp_about_author_author['website'] = get_the_author_meta('url');
$wp_about_author_author['posts'] = (int) get_the_author_posts();
$wp_about_author_author['posts_url'] = get_author_posts_url(get_the_author_meta('ID'));
$wp_about_author_author_pic = get_avatar(get_the_author_meta('email'), '100');
// About Author Title
$wp_about_author_content .= "<h3><a href='" . $wp_about_author_author['posts_url'] . "' title='" . $wp_about_author_author['name'] . "'>" . apply_filters('wp_about_author_name', $wp_about_author_author['name']) . "</a></h3>";
// About Author Description
$wp_about_author_content .= "<p>" . apply_filters('wp_about_author_description', $wp_about_author_author['description']) . "</p>";
// About Author Links
if (!empty($wp_about_author_author['posts_url'])) {
$wp_about_author_links .= "<a href='" . $wp_about_author_author['posts_url'] . "' title='More posts by " . $wp_about_author_author['name'] . "'>" . apply_filters('wp_about_author_more_posts', "More Posts") . "</a> ";
}
if (!empty($wp_about_author_author['website'])) {
if ($wp_about_author_links != "") {
$wp_about_author_links .= apply_filters('wp_about_author_separator', " - ");
}
$wp_about_author_links .= "<a href='" . $wp_about_author_author['website'] . "' title='" . $wp_about_author_author['name'] . "'>" . apply_filters('wp_about_author_website', "Website") . "</a> ";
}
// About Author Social
$wp_about_author_social .= wp_about_author_get_social_links($wp_about_author_settings);
if (isset($wp_about_author_settings['wp_author_social_images']) && $wp_about_author_settings['wp_author_social_images']) {
$wp_about_author_content .= "<p>" . $wp_about_author_links . "</p>";
if ($wp_about_author_social != "") {
$wp_about_author_content .= '<p class="wpa-nomargin">' . apply_filters('wp_about_author_follow_me', "Follow Me:") . '<br />' . $wp_about_author_social . '</p>';
}
} else {
$wp_about_author_content .= "<p class='wpa-nomargin'>";
$wp_about_author_content .= $wp_about_author_links;
if ($wp_about_author_social != "") {
$wp_about_author_content .= apply_filters('wp_about_author_separator', " - ") . $wp_about_author_social;
}
$wp_about_author_content .= "</p>";
}
// Create output
$return_content = '';
// Allow filters to create new templates for output
if (!$for_feed) {
$return_content = apply_filters('wp_about_author_template', '<div class="wp-about-author-containter-%%bordertype%%" style="background-color:%%borderbg%%;"><div class="wp-about-author-pic">%%authorpic%%</div><div class="wp-about-author-text">%%content%%</div></div>');
} else {
$return_content = apply_filters('wp_about_author_feed_template', '<p><div style="float:left; text-align:left;>%%authorpic%%</div>%%content%%</p>');
}
$replace_array = array('%%bordertype%%' => $wp_about_author_settings['wp_author_alert_border'], '%%borderbg%%' => $wp_about_author_settings['wp_author_alert_bg'], '%%authorpic%%' => $wp_about_author_author_pic, '%%content%%' => $wp_about_author_content);
foreach ($replace_array as $search => $replace) {
$return_content = str_replace($search, $replace, $return_content);
}
return apply_filters('wp_about_author_display', $return_content);
}
示例3: test_get_the_author_posts_with_custom_post_type
/**
* @ticket 30904
*/
function test_get_the_author_posts_with_custom_post_type()
{
register_post_type('wptests_pt');
$cpt_ids = self::factory()->post->create_many(2, array('post_author' => $this->author_id, 'post_type' => 'wptests_pt'));
$GLOBALS['post'] = $cpt_ids[0];
$this->assertEquals(2, get_the_author_posts());
_unregister_post_type('wptests_pt');
}
示例4: wp_about_author_display
function wp_about_author_display($for_feed = false)
{
global $post;
$wp_about_author_settings = array();
$wp_about_author_settings = get_option('wp_about_author_settings');
$wp_about_author_content = "";
$wp_about_author_author_pic = "";
$wp_about_author_author = array();
$wp_about_author_author['name'] = get_the_author();
$wp_about_author_author['description'] = get_the_author_meta('description');
$wp_about_author_author['twitter'] = get_the_author_meta('twitter');
$wp_about_author_author['facebook'] = get_the_author_meta('facebook');
$wp_about_author_author['website'] = get_the_author_meta('url');
$wp_about_author_author['posts'] = (int) get_the_author_posts();
$wp_about_author_author['posts_url'] = get_author_posts_url(get_the_author_meta('ID'));
$wp_about_author_author_pic = get_avatar(get_the_author_email(), '100');
$wp_about_author_content .= "<h3><a href='" . $wp_about_author_author['posts_url'] . "' title='" . $wp_about_author_author['name'] . "'>" . $wp_about_author_author['name'] . "</a></h3>";
$wp_about_author_content .= "<p>" . $wp_about_author_author['description'] . "</p>";
$wp_about_author_link = '';
if (!empty($wp_about_author_author['website']) || !empty($wp_about_author_author['twitter']) || !empty($wp_about_author_author['facebook'])) {
$wp_about_author_content .= "<p>";
if (!empty($wp_about_author_author['website'])) {
$wp_about_author_link .= "<a href='" . $wp_about_author_author['website'] . "' title='" . $wp_about_author_author['name'] . "'>Website</a> ";
}
if (!empty($wp_about_author_author['twitter'])) {
if ($wp_about_author_link != "") {
$wp_about_author_link .= "- ";
}
$wp_about_author_link .= "<a href='" . $wp_about_author_author['twitter'] . "' title='" . $wp_about_author_author['name'] . "on Twitter'>Twitter</a> ";
}
if (!empty($wp_about_author_author['facebook'])) {
if ($wp_about_author_link != "") {
$wp_about_author_link .= "- ";
}
$wp_about_author_link .= "<a href='" . $wp_about_author_author['facebook'] . "' title='" . $wp_about_author_author['name'] . " on Facebook'>Facebook</a> ";
}
if (!empty($wp_about_author_author['posts_url'])) {
if ($wp_about_author_link != "") {
$wp_about_author_link .= "- ";
}
$wp_about_author_link .= "<a href='" . $wp_about_author_author['posts_url'] . "' title='More posts by " . $wp_about_author_author['name'] . "'>More Posts</a> ";
}
$wp_about_author_content .= $wp_about_author_link;
$wp_about_author_content .= "</p>";
}
if (!$for_feed) {
return '<div class="wp-about-author-containter-' . $wp_about_author_settings['wp_author_alert_border'] . '" style="background-color:' . $wp_about_author_settings['wp_author_alert_bg'] . ';"><div class="wp-about-author-pic">' . $wp_about_author_author_pic . '</div><div class="wp-about-author-text">' . $wp_about_author_content . '</div></div>';
} else {
return '<p><div style="float:left; text-align:left;>' . $wp_about_author_author_pic . '</div>' . $wp_about_author_content . '</p>';
}
}
示例5: mantra_the_author_fn
/**
* Returns current user information
* Example of use:
* [mantra-author display='attr'] where attr can be author / description / login / first-name / last-name / nickname / id / url / link / aim / yim / posts / posts-url
* Attributes:
* "display" - optional
*/
function mantra_the_author_fn($attr)
{
global $mantra_social_networks;
$id = get_the_author_meta('ID');
if ($id) {
if (isset($attr['display'])) {
$display = $attr['display'];
switch ($display) {
case 'author':
return get_the_author();
case 'description':
return get_the_author_meta('description', $id);
case 'login':
return get_the_author_meta('user_login', $id);
case 'first-name':
return get_the_author_meta('first_name', $id);
case 'last-name':
return get_the_author_meta('last_name', $id);
case 'nickname':
return get_the_author_meta('nickname', $id);
case 'id':
return $id;
case 'url':
return get_the_author_meta('user_url', $id);
case 'email':
return get_the_author_meta('user_email', $id);
case 'link':
if (get_the_author_meta('user_url', $id)) {
return '<a href="' . get_the_author_meta('user_url', $id) . '" title="' . esc_attr(get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
} else {
return get_the_author();
}
case 'aim':
return get_the_author_meta('aim', $id);
case 'yim':
return get_the_author_meta('yim', $id);
case 'posts':
return get_the_author_posts();
case 'posts-url':
return get_author_posts_url(get_the_author_meta('ID'));
}
} else {
return get_the_author();
}
}
}
示例6: rtp_default_post_meta
/**
* Default post meta
*
* @uses $rtp_post_comments Post Comments DB array
* @uses $post Post Data
* @param string $placement Specify the position of the post meta (top/bottom)
*
* @since rtPanel 2.0
*/
function rtp_default_post_meta($placement = 'top')
{
if ('post' == get_post_type() && !rtp_is_bbPress()) {
global $post, $rtp_post_comments;
$position = 'bottom' == $placement ? 'l' : 'u';
// l = Lower/Bottom , u = Upper/Top
if (rtp_has_postmeta($position)) {
if ($position == 'l') {
echo '<footer class="post-footer">';
}
?>
<div class="clearfix post-meta post-meta-<?php
echo esc_attr($placement);
?>
"><?php
if ('bottom' == $placement) {
rtp_hook_begin_post_meta_bottom();
} else {
rtp_hook_begin_post_meta_top();
}
// Author Link
if ($rtp_post_comments['post_author_' . $position] || $rtp_post_comments['post_date_' . $position]) {
if ($rtp_post_comments['post_author_' . $position]) {
printf(__('<span class="rtp-post-author-prefix">By</span> <span class="vcard author">%s</span>', 'rtPanel'), !$rtp_post_comments['author_link_' . $position] ? get_the_author() . ($rtp_post_comments['author_count_' . $position] ? '(' . get_the_author_posts() . ')' : '') : sprintf(__('<a class="fn" href="%1$s" title="%2$s">%3$s</a>', 'rtPanel'), get_author_posts_url(get_the_author_meta('ID'), get_the_author_meta('user_nicename')), esc_attr(sprintf(__('Posts by %s', 'rtPanel'), get_the_author())), get_the_author()) . ($rtp_post_comments['author_count_' . $position] ? '(' . get_the_author_posts() . ')' : ''));
}
echo $rtp_post_comments['post_author_' . $position] && $rtp_post_comments['post_date_' . $position] ? ' ' : '';
if ($rtp_post_comments['post_date_' . $position]) {
printf(__('<span class="rtp-meta-separator">·</span> <time class="published date updated" datetime="%s">%s</time>', 'rtPanel'), get_the_date('c'), get_the_time($rtp_post_comments['post_date_format_' . $position]));
}
}
// Post Categories
echo get_the_category_list() && $rtp_post_comments['post_category_' . $position] ? ' <span class="rtp-meta-separator">·</span> ' . get_the_category_list(', ') . '' : '';
// Comment Count
rtp_default_comment_count();
// Post Tags
echo get_the_tag_list() && $rtp_post_comments['post_tags_' . $position] ? '<p class="post-tags">' . get_the_tag_list(__('Tagged', 'rtPanel') . ': <span>', ', ', '</span>') . '</p>' : '';
// Post Custom Taxonomies
$args = array('_builtin' => false);
$taxonomies = get_taxonomies($args, 'objects');
foreach ($taxonomies as $key => $taxonomy) {
get_the_terms($post->ID, $key) && isset($rtp_post_comments['post_' . $key . '_' . $position]) && $rtp_post_comments['post_' . $key . '_' . $position] ? the_terms($post->ID, $key, '<span class="post-custom-tax post-' . $key . '">' . $taxonomy->labels->singular_name . ': ', ', ', '</span>') : '';
}
if ('bottom' == $placement) {
rtp_hook_end_post_meta_bottom();
} else {
rtp_hook_end_post_meta_top();
}
?>
</div><!-- .post-meta --><?php
if ($position == 'l') {
echo '</footer>';
}
}
} elseif (!rtp_is_bbPress()) {
if (get_edit_post_link() && 'top' == $placement) {
?>
<div class="post-meta post-meta-top"><?php
rtp_hook_end_post_meta_top();
?>
</div><?php
}
}
}
示例7: get_author_posts_url
<div id="author-link">
<?php
if (get_the_author_posts() > 1) {
// if a user has only one post, don't link to their all posts page.
?>
<a href="<?php
echo get_author_posts_url(get_the_author_meta('ID'));
?>
">
<?php
echo "View all posts by " . get_the_author();
?>
<?php
}
if (get_the_author_posts() > 1 and get_the_author_meta('user_url')) {
?>
</a><span> | </span>
<?php
}
if (get_the_author_meta('user_url')) {
// if the user webpage link is filled out, display it.
?>
<a href="<?php
echo get_the_author_meta('user_url');
?>
"><?php
echo "Visit " . trim(get_the_author_meta('user_url'), 'http://');
?>
</a>
<?php
示例8: the_author_posts_shortcode
/**
* [the_author_posts] shortcode
*
* @since 0.1
* @author Ryan Hellyer <ryan@pixopoint.com>
* @return string
*/
public function the_author_posts_shortcode()
{
return get_the_author_posts();
}
示例9: the_author_meta
?>
</h1>
<h2>A propos de l’auteur</h2>
<p class="auteur"><?php
the_author_meta('description');
?>
</p>
<h2>Son profil :</h2>
<p>
<strong>Son eMail</strong> : <?php
echo the_author_meta('user_email');
?>
.<br />
<strong>Son site web</strong> : <?php
echo the_author_meta('user_url');
?>
.<br />
</p>
<p><?php
echo get_the_author();
?>
a écrit <?php
echo get_the_author_posts();
?>
articles dans ce site.</p>
</main>
<?php
get_footer();
?>
<!-- Appel au template du pied de page-->
示例10: get_avatar
<div class="author-info">
<div class="author-avatar">
<?php
echo get_avatar(get_the_author_meta('user_email'), 96);
?>
</div><!-- .author-avatar -->
<div class="author-meta">
<h2 class="author-title"><?php
printf(__('About %s', 'simone'), get_the_author());
?>
</h2>
<div class="share-and-more">
<?php
// Change language depending on number of posts
$posts_posted = get_the_author_posts();
if ($posts_posted == 1) {
printf(__('One article and counting. ', 'simone'));
} else {
printf(__('%s articles and counting. ', 'simone'), the_author_posts());
}
$author_firstname = get_the_author_meta('first_name');
// Check if social media info is collected in user profile
// Usually handled by a plugin like WordPress SEO by Yoast
$author_twitter = get_the_author_meta('twitter');
$author_googleplus = get_the_author_meta('googleplus');
$author_facebook = get_the_author_meta('facebook');
if ($author_twitter || $author_googleplus || $author_facebook) {
echo '<div class="author-social-media">';
printf(__('Follow %s on social media: ', 'simone'), get_the_author_meta('first_name'));
if ($author_twitter) {
示例11: the_author_posts_link
?>
<div class="archive-header"
itemprop="mainEntity" itemscope itemtype="https://schema.org/Person">
<h1 rel="tag" itemprop="name"><?php
the_author_posts_link();
?>
</h1>
<div class="author-meta">
<div class="entry">
<div class="author-photo-cont">
<a href="<?php
echo get_author_posts_url($user_id);
?>
" class="author-nrposts">
<?php
echo number_format_i18n(get_the_author_posts());
?>
</a>
<a href="<?php
echo get_author_posts_url($user_id);
?>
" class="author-photo-anchor">
<?php
$wp_avatar_profile = get_user_meta($user_id, 'wp_avatar_profile', true);
$wp_fb_profile = get_user_meta($user_id, 'wp_fb_profile', true);
$wp_avatar_capability = get_option('wp_avatar_capability', 'read');
$size = '300';
$atts = array('extra_attr' => 'itemprop="image"');
if (user_can($user_id, $wp_avatar_capability)) {
if ('wp-facebook' == $wp_avatar_profile && !empty($wp_fb_profile)) {
$fb = 'https://graph.facebook.com/' . $wp_fb_profile . '/picture?width=' . $size . '&height=' . $size;
示例12: bab_manual
function bab_manual()
{
if (is_single()) {
$bab_showauttxt = get_option('bab_showauttxt');
$bab_auttxt1 = get_option('bab_auttxt1');
$bab_auttxt2 = get_option('bab_auttxt2');
$bab_showautbio = get_option('bab_showautbio');
$bab_showautintro = get_option('bab_showautintro');
$bab_showautgra = get_option('bab_showautgra');
$author = array();
$author['name'] = get_the_author();
$author['twitter'] = get_the_author_meta('twitter');
$author['facebook'] = get_the_author_meta('facebook');
$author['gplus'] = get_the_author_meta('gplus');
$author['posts'] = (int) get_the_author_posts();
$email = get_the_author_meta('email');
ob_start();
?>
<div id="better-author-bio-div" style="background:#F7F7F7; margin:20px 0px 0px 0px; padding:10px 0; border:1px solid #E6E6E6; overflow:hidden; width:100%;" >
<div class="better-author-bio-div-info">
<?php
if ($bab_showautgra == 'y') {
?>
<?php
echo bab_gravatar($email);
?>
<?php
}
?>
<h4 style"margin:0 0 4px 90px; padding:0;" ><?php
printf(esc_attr__('%s %s'), $bab_showautintro, get_the_author());
?>
</h4>
<?php
if ($bab_showauttxt == 'y') {
?>
<p style="margin:0 0 0 90px; padding:0;" class="better-author-bio-div-text"><?php
echo esc_attr(sprintf(__ngettext('%s %s %d %s', '%s %s %d %s', $author['posts'], $bab_auttxt1, $bab_auttxt2, 'better-author-bio-div'), get_the_author_firstname() . ' ' . get_the_author_lastname(), $bab_auttxt1, $author['posts'], $bab_auttxt2));
?>
.</p>
<?php
} else {
echo "<br />";
}
?>
<?php
if ($bab_showautbio == 'y') {
?>
<p style="margin:0 0 0 90px; padding:0;" class="better-author-bio-div-meta"><?php
echo get_the_author_meta('description');
?>
</p>
<?php
} else {
echo "<br />";
}
?>
<ul style="overflow:hidden; margin:0 0 0 90px; padding:0;" >
<li style="list-style-type:none; float:left; margin:8px 6px 0 0; padding:0 0 0 6px; line-height:120%; border-left:1px solid #ccc;" class="first" ><a href="<?php
echo get_author_posts_url(get_the_author_meta('ID'));
?>
">
<?php
printf(__('View all posts by %s <span class="meta-nav">→</span>'), get_the_author());
?>
</a></li>
<li style="list-style-type:none; float:left; margin:8px 6px 0 0; padding:0 0 0 6px; line-height:120%; border-left:1px solid #ccc;" class="first" ><a href="<?php
echo get_the_author_meta('url');
?>
" title="<?php
echo esc_attr(sprintf(__('Read %s’s blog', 'better-author-bio-div'), $author['name']));
?>
"><?php
echo __("Blog");
?>
</a></li>
<?php
if (!empty($author['twitter'])) {
?>
<li style="list-style-type:none; float:left; margin:8px 6px 0 0; padding:0 0 0 6px; line-height:120%; border-left:1px solid #ccc;" class="first" ><a href="<?php
echo $author['twitter'];
?>
" title="<?php
echo esc_attr(sprintf(__('Follow %s on Twitter', 'better-author-bio-div'), $author['name']));
?>
" rel="external">Twitter</a></li>
<?php
}
?>
<?php
if (!empty($author['facebook'])) {
?>
<li style="list-style-type:none; float:left; margin:8px 6px 0 0; padding:0 0 0 6px; line-height:120%; border-left:1px solid #ccc;" class="first" ><a href="<?php
echo $author['facebook'];
?>
" title="<?php
echo esc_attr(sprintf(__('Be %s’s friend on Facebook', 'better-author-bio-div'), $author['name']));
?>
" rel="external">Facebook</a></li><?php
//.........这里部分代码省略.........
示例13: get_page_subheading
/**
* Returns page subheading
*
* @since 3.0.0
*/
private function get_page_subheading()
{
// Subheading is NULL by default
$subheading = NULL;
// Posts & Pages
if ($meta = get_post_meta($this->post_id, 'wpex_post_subheading', true)) {
$subheading = $meta;
} elseif (is_search()) {
$subheading = __('You searched for:', 'wpex') . ' "' . esc_html(get_search_query(false)) . '"';
} elseif (is_category()) {
if ('under_title' == wpex_get_mod('category_description_position', 'under_title')) {
$subheading = term_description();
}
} elseif (is_author()) {
$subheading = __('This author has written', 'wpex') . ' ' . get_the_author_posts() . ' ' . __('articles', 'wpex');
} elseif (is_tax() && !wpex_has_term_description_above_loop()) {
$subheading = term_description();
}
// Apply filters and return
return apply_filters('wpex_post_subheading', $subheading);
}
示例14: pixopoint_the_author_posts_shortcode
/**
* [the_author_posts] shortcode
* @since 0.1
*/
function pixopoint_the_author_posts_shortcode()
{
return get_the_author_posts();
}
示例15: the_author_link
?>
: <?php
the_author_link();
?>
</h3>
<p><?php
echo get_the_author_meta('description');
?>
</p>
</div>
<?php
if (get_the_author_meta('facebook') != '' | get_the_author_meta('twitter') != '' | get_the_author_meta('googleplus') != '' | get_the_author_meta('instagram') != '' | get_the_author_meta('rss') != '') {
?>
<div class="social01">
<?php
if (get_the_author_posts() > 1) {
?>
<p class="articles"><?php
esc_attr_e('More articles', 'converio');
?>
<?php
esc_attr_e('by', 'converio');
?>
<?php
the_author_posts_link();
?>
</p>
<?php
}
?>
<p><?php