本文整理汇总了PHP中get_coauthors函数的典型用法代码示例。如果您正苦于以下问题:PHP get_coauthors函数的具体用法?PHP get_coauthors怎么用?PHP get_coauthors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_coauthors函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 »</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
示例16: WP_Query
//Anzahl Ergebnisse
echo $wp_query->found_posts . ' Artikel';
echo '</p>';
//Zeitraum berechnen
$parameters = $wp_query->query_vars;
$parameters['nopaging'] = true;
$myquery = new WP_Query($parameters);
$posts = $myquery->posts;
if (sizeof($posts) > 1) {
echo '<p class="smalltext">';
echo 'Zeitraum: ' . get_the_time('j. F Y', $posts[sizeof($posts) - 1]->ID) . ' – ' . get_the_time('j. F Y', $posts[0]->ID);
echo '</p>';
}
//Autoren (sollte noch gegen deaktivierung des Coauthors Plugins abgesichert werden)
foreach ($posts as $p) {
$tmp = get_coauthors($p->ID);
foreach ($tmp as $t) {
//eventuell könnte man statt einem Link zum Autorenarchiv irgendwie eine Filterfunktion für das aktuelle Archiv implementieren. Aber das ist irgendwie kompliziert.
$authors[] = '<a href="' . get_author_posts_url($t->ID) . '">' . $t->display_name . '</a>';
}
}
$authors = array_unique($authors);
asort($authors);
if (count($authors) > 0) {
echo '<p class="smalltext">' . (count($authors) > 1 ? count($authors) . ' Autoren' : '1 Autor') . ':';
echo '<ul class="sidebar_list_categories smalltext">';
foreach ($authors as $a) {
echo '<li>' . $a . '</li>';
}
echo '</li></p>';
}
开发者ID:TVLuke,项目名称:wordpress,代码行数:31,代码来源:search.php
示例17: bdn_xmlrpc_get_posts
function bdn_xmlrpc_get_posts($args)
{
global $wp_xmlrpc_server;
$wp_xmlrpc_server->escape($args);
$blog_ID = (int) $args[0];
$username = $args[1];
$password = $args[2];
$post_type = $args[3];
$category = $args[4];
$numberposts = $args[5];
$extra = $args[6];
if (!($user = $wp_xmlrpc_server->login($username, $password))) {
return $wp_xmlrpc_server->error;
}
$category_int = (int) $category;
if (!empty($category_int)) {
$category_call = 'cat';
} else {
$category_call = 'category_name';
}
$post_args = array('numberposts' => $numberposts, 'posts_per_page' => $numberposts, $category_call => $category, 'post_type' => $post_type, 'post_status' => 'any');
if (is_array($extra)) {
$post_args = array_merge($post_args, $extra);
}
$posts_list = query_posts($post_args);
if (!$posts_list) {
$wp_xmlrpc_server->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
return $wp_xmlrpc_server->error;
}
foreach ($posts_list as $entry) {
if (!current_user_can('edit_post', $entry->ID)) {
continue;
}
$post_date = mysql2date('Ymd\\TH:i:s', $entry->post_date, false);
$post_date_gmt = mysql2date('Ymd\\TH:i:s', $entry->post_date_gmt, false);
$post_modified = mysql2date('Ymd\\TH:i:s', $entry->post_modified, false);
// For drafts use the GMT version of the date
if ($entry->post_status == 'draft') {
$post_date_gmt = get_gmt_from_date(mysql2date('Y-m-d H:i:s', $entry->post_date), 'Ymd\\TH:i:s');
}
$categories = array();
$cats = get_the_category($entry->ID, 'category');
foreach ($cats as $cat) {
$categories[] = array('name' => $cat->cat_name, 'parent' => $cat->category_parent);
}
$publications = array();
$pubs = get_the_terms($entry->ID, 'publication');
foreach ($pubs as $pub) {
$publications[] = $pub->name;
}
$post = get_extended($entry->post_content);
$link = post_permalink($entry->ID);
// Get the post author info.
$authors = (array) get_userdata($entry->post_author);
if (function_exists('get_coauthors')) {
$authors = get_coauthors($entry->ID);
}
$allow_comments = 'open' == $entry->comment_status ? 1 : 0;
$allow_pings = 'open' == $entry->ping_status ? 1 : 0;
// Consider future posts as published
if ($entry->post_status === 'future') {
$entry->post_status = 'publish';
}
$entryPost = array('post_date' => new IXR_Date($post_date), 'post_updated' => new IXR_Date($post_modified), 'userid' => $entry->post_author, 'post_id' => $entry->ID, 'description' => $post['main'], 'post_title' => $entry->post_title, 'link' => $link, 'permaLink' => $link, 'post_parent' => strval($post['post_parent']), 'post_content' => $entry->post_content, 'categories' => $categories, 'mt_excerpt' => $entry->post_excerpt, 'mt_text_more' => $post['extended'], 'mt_allow_comments' => $allow_comments, 'mt_allow_pings' => $allow_pings, 'wp_slug' => $entry->post_name, 'wp_password' => $entry->post_password, 'wp_authors' => $authors, 'date_created_gmt' => new IXR_Date($post_date_gmt), 'post_status' => $entry->post_status, 'custom_fields' => $wp_xmlrpc_server->get_custom_fields($entry->ID), 'publications' => $publications);
$post_type_taxonomies = get_object_taxonomies(POST_TYPE, 'names');
$terms = wp_get_object_terms($entry->ID, $post_type_taxonomies);
$entryPost['terms'] = array();
foreach ($terms as $term) {
$entryPost['terms'][] = _prepare_term($term);
}
$struct[] = $entryPost;
}
$recent_posts = array();
for ($j = 0; $j < count($struct); $j++) {
array_push($recent_posts, $struct[$j]);
}
return $recent_posts;
}
开发者ID:andboson,项目名称:WordPress-xmlrpc-extenders,代码行数:78,代码来源:plugin.php
示例18: post_to_nprml_story
/**
*
* Do the mapping from WP post to the array that we're going to build the NPRML from.
* This is also where we will do custom mapping if need be.
* If a mapped custom field does not exist in a certain post, just send the default field.
* @param $post
*/
function post_to_nprml_story($post)
{
$story = array();
$story[] = array('tag' => 'link', 'attr' => array('type' => 'html'), 'text' => get_permalink($post));
$use_custom = get_option('dp_npr_push_use_custom_map');
//get the list of metas available for this post
$post_metas = get_post_custom_keys($post->ID);
$teaser_text = '';
if (!empty($post->post_excerpt)) {
$teaser_text = $post->post_excerpt;
}
$custom_content_meta = get_option('ds_npr_api_mapping_body');
if ($use_custom && !empty($custom_content_meta) && $custom_content_meta != '#NONE#' && in_array($custom_content_meta, $post_metas)) {
$content = get_post_meta($post->ID, $custom_content_meta, true);
$post_for_teaser = $post;
$post_for_teaser->post_content = $content;
if (empty($teaser_text)) {
$teaser_text = nai_get_excerpt($post_for_teaser);
}
} else {
$content = $post->post_content;
if (empty($teaser_text)) {
$teaser_text = nai_get_excerpt($post);
}
}
//lets see if there are any plugins that need to fix their shortcodes before we run do_shortcode
if (has_filter('npr_ds_shortcode_filter')) {
$content = apply_filters('npr_ds_shortcode_filter', $content);
}
//let any plugin that has short codes try and replace those with HTML
$content = do_shortcode($content);
//for any remaining short codes, nuke 'em
$content = strip_shortcodes($content);
$content = apply_filters('the_content', $content);
$story[] = array('tag' => 'teaser', 'text' => $teaser_text);
$custom_title_meta = get_option('ds_npr_api_mapping_title');
if ($use_custom && !empty($custom_title_meta) && $custom_title_meta != '#NONE#' && in_array($custom_content_meta, $post_metas)) {
$custom_title = get_post_meta($post->ID, $custom_title_meta, true);
$story[] = array('tag' => 'title', 'text' => $custom_title);
} else {
$story[] = array('tag' => 'title', 'text' => $post->post_title);
}
/**
*
*If there is a custom byline configured, send that.
*If the site is using the coauthurs plugin, and get_coauthors exists, send the display names
*
*If no cool things are going on, just send the display name for the post_author field.
*
*/
$byline = FALSE;
$custom_byline_meta = get_option('ds_npr_api_mapping_byline');
if ($use_custom && !empty($custom_byline_meta) && $custom_byline_meta != '#NONE#' && in_array($custom_content_meta, $post_metas)) {
$byline = TRUE;
$story[] = array('tag' => 'byline', 'children' => array(array('tag' => 'name', 'text' => get_post_meta($post->ID, $custom_byline_meta, true))));
}
if (function_exists('get_coauthors')) {
$coauthors = get_coauthors($post->ID);
if (!empty($coauthors)) {
$byline = TRUE;
foreach ($coauthors as $i => $co) {
$story[] = array('tag' => 'byline', 'children' => array(array('tag' => 'name', 'text' => $co->display_name)));
}
} else {
error_log('we do not have co authors');
}
} else {
error_log('can not find get_coauthors');
}
if (!$byline) {
$story[] = array('tag' => 'byline', 'children' => array(array('tag' => 'name', 'text' => get_the_author_meta('display_name', $post->post_author))));
}
// NPR One
if (!empty($_POST['send_to_nprone'])) {
$story[] = array('tag' => 'parent', 'attr' => array('id' => '319418027', 'type' => 'collection'));
}
#'miniTeaser' => array( 'text' => '' ),
#'slug' => array( 'text' => '' ),
$story[] = array('tag' => 'storyDate', 'text' => mysql2date('D, d M Y H:i:s +0000', $post->post_date_gmt));
$story[] = array('tag' => 'pubDate', 'text' => mysql2date('D, d M Y H:i:s +0000', $post->post_modified_gmt));
$story[] = array('tag' => 'lastModifiedDate', 'text' => mysql2date('D, d M Y H:i:s +0000', $post->post_modified_gmt));
$story[] = array('tag' => 'partnerId', 'text' => $post->guid);
//TODO: When the API accepts sending both text and textWithHTML, send a totally bare text. Don't do do_shortcode().
//for now (using the npr story api) we can either send text or textWithHTML, not both.
//it would be nice to send text after we strip all html and shortcodes, but we need the html
//and sending both will duplicate the data in the API
$story[] = array('tag' => 'textWithHtml', 'children' => split_paragraphs($content));
$perms_group = get_option('ds_npr_story_default_permission');
if (!empty($perms_group)) {
$story[] = array('tag' => 'permissions', 'children' => array(array('tag' => 'permGroup', 'attr' => array('id' => $perms_group))));
}
$custom_media_credit = get_option('ds_npr_api_mapping_media_credit');
$custom_media_agency = get_option('ds_npr_api_mapping_media_agency');
//.........这里部分代码省略.........
开发者ID:mike-douglas,项目名称:WP-DS-NPR-API,代码行数:101,代码来源:nprml.php
示例19: display_testimonies
function display_testimonies($arguments = array())
{
$post_id = $arguments['post_id'] ? $arguments['post_id'] : get_the_ID();
$number_requested = $arguments['number_requested'] ? $arguments['number_requested'] : 3;
$section_title = $arguments['section_title'] ? $arguments['section_title'] : 'Testimonies';
$query_args = array('orderby' => 'rand', 'post_type' => 'testimonies', 'programs_tax' => get_the_slug($post_id), 'posts_per_page' => $number_requested);
$the_query = new WP_Query($query_args);
// The Loop
if ($the_query->have_posts()) {
?>
<div class="standard-testimonies-container">
<h2><?php
echo $section_title;
?>
</h2>
<?php
while ($the_query->have_posts()) {
$the_query->the_post();
// Get Author Information
$author = get_coauthors($post->ID)[0];
?>
<div class="testimony-container">
<div class="row">
<div class="columns medium-10">
<h6><i class="fa fa-quote-left"></i><?php
the_title();
?>
</h6>
<?php
the_content();
?>
<div class="testimony-author-info">- <?php
echo $author->display_name . ', ' . rwmb_meta('author_involvement');
?>
</div>
</div>
<div class="columns medium-2 author-image">
<?php
echo get_the_post_thumbnail($author->ID, 'thumbnail', array('class' => 'img-responsive-80'));
?>
</div>
</div>
</div>
<?php
}
?>
</div>
<?php
}
/* Restore original Post Data */
wp_reset_postdata();
?>
<?php
}
开发者ID:josh-rathke,项目名称:WaterTower,代码行数:63,代码来源:testimonies_cpt.php
示例20: filter_jetpack_open_graph_tags
/**
* Filter non-native users added by Co-Author-Plus in Jetpack
*
* @since 3.1
*
* @param array $og_tags Required. Array of Open Graph Tags.
* @param array $image_dimensions Required. Dimensions for images used.
* @return array Open Graph Tags either as they were passed or updated.
*/
public function filter_jetpack_open_graph_tags($og_tags, $image_dimensions)
{
if (is_author()) {
$author = get_queried_object();
$og_tags['og:title'] = $author->display_name;
$og_tags['og:url'] = get_author_posts_url($author->ID, $author->user_nicename);
$og_tags['og:description'] = $author->description;
$og_tags['profile:first_name'] = $author->first_name;
$og_tags['profile:last_name'] = $author->last_name;
if (isset($og_tags['article:author'])) {
$og_tags['article:author'] = get_author_posts_url($author->ID, $author->user_nicename);
}
} else {
if (is_singular() && $this->is_post_type_enabled()) {
$authors = get_coauthors();
if (!empty($authors)) {
$author = array_shift($authors);
if (isset($og_tags['article:author'])) {
$og_tags['article:author'] = get_author_posts_url($author->ID, $author->user_nicename);
}
}
}
}
// Send back the updated Open Graph Tags
return apply_filters('coauthors_open_graph_tags', $og_tags);
}
开发者ID:singhrajdeep,项目名称:Co-Authors-Plus,代码行数:35,代码来源:co-authors-plus.php
注:本文中的get_coauthors函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论