当前位置: 首页>>代码示例>>PHP>>正文


PHP get_coauthors函数代码示例

本文整理汇总了PHP中get_coauthors函数的典型用法代码示例。如果您正苦于以下问题:PHP get_coauthors函数的具体用法?PHP get_coauthors怎么用?PHP get_coauthors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_coauthors函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_add_rss_guest_authors

 function action_add_rss_guest_authors()
 {
     $coauthors = get_coauthors();
     // remove the first guest author who is added to the first dc:creator element
     array_shift($coauthors);
     foreach ($coauthors as $coauthor) {
         echo '      <dc:creator><![CDATA[' . $coauthor->display_name . "]]></dc:creator>\n";
     }
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:9,代码来源:class-coauthors-template-filters.php

示例2: cap_update_amp_json_metadata

function cap_update_amp_json_metadata($metadata, $post)
{
    $authors = get_coauthors($post->ID);
    $authors_json = array();
    foreach ($authors as $author) {
        $authors_json[] = array('@type' => 'Person', 'name' => $author->display_name);
    }
    $metadata['author'] = $authors_json;
    return $metadata;
}
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:10,代码来源:amp.php

示例3: widget

    function widget($args, $instance)
    {
        global $post;
        extract($args);
        $authors = array();
        $bios = '';
        if (get_post_meta($post->ID, 'largo_byline_text')) {
            $byline_text = esc_attr(get_post_meta($post->ID, 'largo_byline_text', true));
        }
        $is_series_landing = function_exists('largo_is_series_landing') ? largo_is_series_landing($post) : false;
        if ((is_singular() || is_author() || $is_series_landing) && empty($byline_text)) {
            if (is_singular() || $is_series_landing) {
                if (function_exists('get_coauthors')) {
                    $authors = get_coauthors(get_queried_object_id());
                } else {
                    $authors = array(get_user_by('id', get_queried_object()->post_author));
                }
            } else {
                if (is_author()) {
                    $authors = array(get_queried_object());
                }
            }
            // make sure we have at least one bio before we show the widget
            foreach ($authors as $key => $author) {
                $bio = trim($author->description);
                if (!is_author() && empty($bio)) {
                    unset($authors[$key]);
                } else {
                    $bios .= $bio;
                }
            }
            if (!is_author() && empty($bios)) {
                return;
            }
            foreach ($authors as $author_obj) {
                $ctx = array('author_obj' => $author_obj);
                ?>

				<div class="author-box row-fluid author vcard clearfix">
					<?php 
                largo_render_template('partials/author-bio', 'description', $ctx);
                ?>
					<?php 
                largo_render_template('partials/author-bio', 'social-links', $ctx);
                ?>
				</div>

				<?php 
            }
            // foreach
        } elseif (empty($byline_text)) {
            _e('Not a valid author context');
        }
        echo $after_widget;
    }
开发者ID:uniteddiversity,项目名称:Largo,代码行数:55,代码来源:largo-author-bio.php

示例4: be_author_box

/**
 * Load Author Boxes
 *
 * @author Bill Erickson
 * @link http://www.billerickson.net/wordpress-post-multiple-authors/
 */
function be_author_box()
{
    if (!is_single()) {
        return;
    }
    if (function_exists('get_coauthors')) {
        $authors = get_coauthors();
        foreach ($authors as $author) {
            be_do_author_box($author->data->ID);
        }
    } else {
        be_do_author_box(get_the_author_ID());
    }
}
开发者ID:generationentandem,项目名称:website,代码行数:20,代码来源:co-authors.php

示例5: authors

 /**
  * Filters {{ post.authors }} to return authors stored from Co-Authors Plus
  * @since 1.1.4
  * @param array $author
  * @param Post $post
  * @return array of User objects
  */
 public function authors($author, $post)
 {
     $authors = array();
     $cauthors = get_coauthors($post->ID);
     foreach ($cauthors as $author) {
         $uid = $this->get_user_uid($author);
         if ($uid) {
             $authors[] = new \Timber\User($uid);
         } else {
             $authors[] = new CoAuthorsPlusUser($author);
         }
     }
     return $authors;
 }
开发者ID:jarednova,项目名称:timber,代码行数:21,代码来源:CoAuthorsPlus.php

示例6: wplms_coauthor_plus_course_instructor

 public function wplms_coauthor_plus_course_instructor($authors, $post_id)
 {
     if (function_exists('get_coauthors')) {
         $coauthors = get_coauthors($post_id);
         if (isset($coauthors) && is_array($coauthors)) {
             $authors = array();
             foreach ($coauthors as $author) {
                 if (!in_array($author->ID, $authors)) {
                     $authors[] = $author->ID;
                 }
             }
         }
     }
     return $authors;
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:15,代码来源:wplms-coauthor-plus.php

示例7: CoAuthorsIterator

 function CoAuthorsIterator($postID = 0)
 {
     global $post, $authordata, $wpdb;
     $postID = (int) $postID;
     if (!$postID && $post) {
         $postID = (int) $post->ID;
     }
     if (!$postID) {
         trigger_error(__('No post ID provided for CoAuthorsIterator constructor. Are you not in a loop or is $post not set?', 'co-authors-plus'));
     }
     //return null;
     $this->original_authordata = $authordata;
     $this->authordata_array = get_coauthors($postID);
     $this->count = count($this->authordata_array);
 }
开发者ID:jayfresh,项目名称:SweetSpot,代码行数:15,代码来源:template-tags.php

示例8: test_add_coauthor_to_post

 /**
  * Test assigning a Co-Author to a post
  */
 public function test_add_coauthor_to_post()
 {
     global $coauthors_plus;
     $coauthors = get_coauthors($this->author1_post1);
     $this->assertEquals(1, count($coauthors));
     // append = true, should preserve order
     $editor1 = get_user_by('id', $this->editor1);
     $coauthors_plus->add_coauthors($this->author1_post1, array($editor1->user_login), true);
     $coauthors = get_coauthors($this->author1_post1);
     $this->assertEquals(array($this->author1, $this->editor1), wp_list_pluck($coauthors, 'ID'));
     // append = false, overrides existing authors
     $coauthors_plus->add_coauthors($this->author1_post1, array($editor1->user_login), false);
     $coauthors = get_coauthors($this->author1_post1);
     $this->assertEquals(array($this->editor1), wp_list_pluck($coauthors, 'ID'));
 }
开发者ID:voceconnect,项目名称:Co-Authors-Plus,代码行数:18,代码来源:test-manage-coauthors.php

示例9: hsinsider_get_post_byline

/**
 * Retrieve and compile Post Byline Information
 */
function hsinsider_get_post_byline()
{
    $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    if (get_the_time('U') !== get_the_modified_time('U')) {
        $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()));
    } else {
        $time_string = sprintf($time_string, esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
    }
    $posted_on = '<span class="posted_on">' . $time_string . '</span>';
    $byline = hsinsider_get_coauthors() . $posted_on;
    $author = get_coauthors()[0];
    $avatar = '';
    if (!is_author()) {
        $avatar = get_avatar($author->ID, 96, '', '', array('class' => 'img-circle'));
    }
    echo '<figure class="byline">' . wp_kses_post($avatar) . '<figcaption>' . wp_kses_post($byline) . '</figcaption></figure>';
}
开发者ID:jperezlatimes,项目名称:hsinsider,代码行数:20,代码来源:template-tags.php

示例10: test_manage_author_roles_relationships

 /**
  * Test assigning a WP user a role on a post.
  */
 public function test_manage_author_roles_relationships()
 {
     global $coauthors_plus;
     $author1 = get_user_by('id', $this->author1);
     $editor1 = get_user_by('id', $this->editor1);
     // Setup: assign author1 as the only co-author (byline)
     $coauthors_plus->add_coauthors($this->author1_post1, array($author1->user_nicename), false);
     $this->assertEquals($this->author1, get_post($this->author1_post1)->post_author);
     // Add a coauthor in a non-byline role. Should not be returned by get_coauthors.
     \CoAuthorsPlusRoles\set_author_on_post($this->author1_post1, $editor1, 'contributor');
     $coauthors = get_coauthors($this->author1_post1);
     $coauthors_this_plugin = CoAuthorsPlusRoles\get_coauthors($this->author1_post1);
     $this->assertEquals(count($coauthors), count($coauthors_this_plugin));
     $this->assertEquals(1, count($coauthors));
     $all_credits = CoAuthorsPlusRoles\get_coauthors($this->author1_post1, array('author_role' => 'any'));
     $this->assertEquals(2, count($all_credits));
     // Remove a co-author from a post
     \CoAuthorsPlusRoles\remove_author_from_post($this->author1_post1, $this->editor1);
     $all_credits = CoAuthorsPlusRoles\get_coauthors($this->author1_post1, array('author_role' => 'any'));
     $this->assertEquals(1, count($all_credits));
 }
开发者ID:serhi,项目名称:Co-Authors-Plus-Roles,代码行数:24,代码来源:test-manage-contributors.php

示例11: authors

 /**
  * Filter the authors
  *
  * @param array  $authors  The current authors
  * @param int    $post_id  The current post ID
  */
 function authors($authors, $post_id)
 {
     if (function_exists('get_coauthors')) {
         $coauthors = get_coauthors($post_id);
         $authors = array();
         foreach ($coauthors as $coauthor) {
             $author = new stdClass();
             $author->ID = $coauthor->ID;
             $author->display_name = is_a($coauthor, 'WP_User') ? $coauthor->data->display_name : $coauthor->display_name;
             $author->first_name = $coauthor->first_name;
             $author->last_name = $coauthor->last_name;
             $author->user_login = is_a($coauthor, 'WP_User') ? $coauthor->data->user_login : $coauthor->user_login;
             $author->user_nicename = is_a($coauthor, 'WP_User') ? $coauthor->data->user_nicename : $coauthor->user_nicename;
             $author->user_email = is_a($coauthor, 'WP_User') ? $coauthor->data->user_email : $coauthor->user_email;
             $author->user_url = is_a($coauthor, 'WP_User') ? $coauthor->data->user_url : $coauthor->website;
             $author->bio = $coauthor->description;
             $authors[] = $author;
         }
     }
     return $authors;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:27,代码来源:class-instant-articles-co-authors-plus.php

示例12: pabx_add_replace_values

/**
* Set replacement values for specific tokens with Post Author Box
*/
function pabx_add_replace_values($tokens)
{
    global $coauthors_plus;
    if (!function_exists('coauthors')) {
        return $tokens;
    }
    $coauthor = array_shift(get_coauthors());
    // Co-Authors Plus specific tokens
    $tokens['%coauthors%'] = coauthors(null, null, null, null, false);
    $tokens['%coauthors_posts_links%'] = coauthors_posts_links(null, null, null, null, false);
    $tokens['%coauthors_firstnames%'] = coauthors_firstnames(null, null, null, null, false);
    // Modify these tokens too, because they might be guest authors
    $tokens['%display_name%'] = $coauthor->display_name;
    $tokens['%first_name%'] = $coauthor->first_name;
    $tokens['%last_name%'] = $coauthor->last_name;
    $tokens['%description%'] = $coauthor->description;
    $tokens['%email%'] = $coauthor->email;
    $tokens['%jabber%'] = $coauthor->jabber;
    $tokens['%aim%'] = $coauthor->aim;
    $tokens['%avatar%'] = get_avatar($coauthor->user_email);
    return $tokens;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:25,代码来源:wpcom-helper.php

示例13: get_first_author_name

 /**
  * Get the post's first author's name
  *
  * @return string The author's name (last name if set, but has fallbacks)
  */
 function get_first_author_name()
 {
     if (function_exists('get_coauthors')) {
         $authors = get_coauthors($this->id);
     } else {
         $authors = [get_userdata($this->id)];
     }
     if (!$authors) {
         return '';
     }
     $author = $authors[0];
     if ($author->last_name) {
         return $author->last_name;
     }
     return $author->display_name;
 }
开发者ID:Shelob9,项目名称:eight-day-week,代码行数:21,代码来源:article-export.php

示例14: bloginfo

        }
        ?>
	<?php 
    } else {
        ?>
		<meta property="og:image" content="<?php 
        bloginfo('template_url');
        ?>
/img/og-image.png" />
	<?php 
    }
    ?>

	<!-- List the post authors -->
	<?php 
    $authors = get_coauthors();
    foreach ($authors as $author) {
        echo "<meta property=\"article:author\" content=\"" . get_author_posts_url($author->ID) . "\">\n";
    }
    ?>

	<!-- Article publish and expiration dates -->
	<meta property="article:published_time" content="<?php 
    echo get_the_time("Y-m-d\\TH:i:sT");
    ?>
">
	<meta property="article:expiration_time" content="<?php 
    echo date('Y-m-d', strtotime(date('Y-m-d', strtotime(get_the_time('Y-m-d'))) . '+4 day'));
    ?>
">
开发者ID:wsander3,项目名称:Pipe-Dream,代码行数:30,代码来源:open-graph.php

示例15: array

        ?>
</strong></li>
			<li><?php 
        echo $postcode;
        ?>
</li>			
		</ul>
		<p class=" right alignright last">
			<!-- <a class="small shiny orange round button" title="Map" href="#">Map &raquo;</a> -->
		</p>
		
		<?php 
        $applicants = array();
        $future_tenants = array();
        $managers = array();
        $co_authors = get_coauthors($post->ID);
        foreach ($co_authors as $author) {
            $user = new WP_User($author->ID);
            // print_r($author);
            if (!empty($user->roles) && is_array($user->roles)) {
                foreach ($user->roles as $role) {
                    // echo $role;
                    if ($role == "applicant") {
                        $applicants[] = $user;
                    } elseif ($role == "future_tenant") {
                        $future_tenants[] = $user;
                    } elseif ($role == "manager") {
                        $managers[] = $user;
                    } elseif ($role == "tenant") {
                        $tenants[] = $user;
                    }
开发者ID:jayfresh,项目名称:SweetSpot,代码行数:31,代码来源:backup-admin-dash.php


注:本文中的get_coauthors函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。