本文整理汇总了PHP中get_the_author_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_author_meta函数的具体用法?PHP get_the_author_meta怎么用?PHP get_the_author_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_author_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: square_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function square_posted_on()
{
$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 = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
$posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
$byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
$comment_count = get_comments_number();
// get_comments_number returns only a numeric value
if (comments_open()) {
if ($comment_count == 0) {
$comments = __('No Comments', 'square');
} elseif ($comment_count > 1) {
$comments = $comment_count . __(' Comments', 'square');
} else {
$comments = __('1 Comment', 'square');
}
$comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
} else {
$comment_link = __(' Comment Closed', 'square');
}
echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
// WPCS: XSS OK.
}
示例2: comment
protected function comment($comment, $depth, $args)
{
// разметка каждого комментария, без закрывающего </li>!
$classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : '');
// берем стандартные классы комментария и если коммент пренадлежит автору поста добавляем класс author-comment
echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n";
// родительский тэг комментария с классами выше и уникальным id
echo '<div id="comment-' . get_comment_ID() . '">' . "\n";
// элемент с таким id нужен для якорных ссылок на коммент
echo get_avatar($comment, 64) . "\n";
// покажем аватар с размером 64х64
echo '<p class="meta">Автор: ' . get_comment_author() . "\n";
// имя автора коммента
//echo ' '.get_comment_author_email(); // email автора коммента
echo ' ' . get_comment_author_url();
// url автора коммента
echo ' <br>Добавлено ' . get_comment_date('F j, Y') . ' в ' . get_comment_time() . "\n";
// дата и время комментирования
if ('0' == $comment->comment_approved) {
echo '<em class="comment-awaiting-moderation">Ваш комментарий будет опубликован после проверки модератором.</em>' . "\n";
}
// если комментарий должен пройти проверку
comment_text() . "\n";
// текст коммента
$reply_link_args = array('depth' => $depth, 'reply_text' => 'Ответить', 'login_text' => 'Вы должны быть залогинены');
echo get_comment_reply_link(array_merge($args, $reply_link_args));
// выводим ссылку ответить
echo '</div>' . "\n";
// закрываем див
}
示例3: xfac_get_avatar
function xfac_get_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = '')
{
if (is_numeric($id_or_email)) {
$wpUserId = (int) $id_or_email;
} elseif (is_string($id_or_email) && ($user = get_user_by('email', $id_or_email))) {
$wpUserId = $user->ID;
} elseif (is_object($id_or_email) && !empty($id_or_email->user_id)) {
$wpUserId = (int) $id_or_email->user_id;
}
if (empty($wpUserId)) {
// cannot figure out the user id...
return $avatar;
}
$apiRecords = xfac_user_getRecordsByUserId($wpUserId);
if (empty($apiRecords)) {
// no api records
return $avatar;
}
$apiRecord = reset($apiRecords);
if (empty($apiRecord->profile['links']['avatar'])) {
// no avatar?
return $avatar;
}
$avatar = $apiRecord->profile['links']['avatar'];
$size = (int) $size;
if (empty($alt)) {
$alt = get_the_author_meta('display_name', $wpUserId);
}
$author_class = is_author($wpUserId) ? ' current-author' : '';
$avatar = "<img alt='" . esc_attr($alt) . "' src='" . esc_url($avatar) . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' />";
return $avatar;
}
示例4: argo_staff_fields
function argo_staff_fields($user)
{
?>
<h3>Argo User Settings</h3>
<table class="form-table">
<tr>
<th><label for="argo_twitter">Twitter username</label></th>
<td>
<input type="text" name="argo_twitter" id="argo_twitter" value="<?php
echo esc_attr(get_the_author_meta('argo_twitter', $user->ID));
?>
" class="regular-text" /><br />
<span class="description">Please enter your Twitter username</span>
</td>
</tr>
<tr>
<th>Blog Host?</th>
<td>
<input type="checkbox" name="argo_is_staff" id="argo_is_staff" value="1" <?php
checked(1, get_the_author_meta('argo_is_staff', $user->ID));
?>
/> <label for="argo_is_staff">Yes</label><br />
<span class="description">Blog hosts appear in the blog host widget.</span>
</td>
</tr>
</table>
<?php
}
示例5: jrd_comment
function jrd_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
//print_r($comment);
/* Check if post is by Author for special styling */
$isByAuthor = false;
if ($comment->comment_author_email == get_the_author_meta('email')) {
$isByAuthor = true;
}
?>
<li class="clearfix">
<div class="author">
<h6><?php
echo $comment->comment_author;
?>
</h6>
<p class="timestamp"><?php
printf(__('%1$s at %2$s'), get_comment_date('n/j/Y'), get_comment_time('g:ia'));
?>
</p>
</div>
<div class="commenttext">
<?php
comment_text();
?>
</div>
</li>
<?php
}
示例6: roots_entry_meta
function roots_entry_meta()
{
echo '<div id="author-info">';
echo '<time class="updated" datetime="' . get_the_time('c') . '" pubdate>' . sprintf(__('Posted on %s at %s.', 'roots'), get_the_date(), get_the_time()) . '</time>';
echo '<p class="byline author vcard">' . __('Written by', 'roots') . ' <a href="' . get_author_posts_url(get_the_author_meta('id')) . '" rel="author" class="fn">' . get_the_author() . '</a></p>';
echo '</div>';
}
示例7: __construct
public function __construct($wpUser)
{
$this->id = $wpUser->ID;
if (function_exists('get_wp_user_avatar_src')) {
if (strlen(get_wp_user_avatar_src($this->id, 'original')) > 0) {
$this->image = get_wp_user_avatar_src($this->id, 'original');
}
}
if (!strlen($this->image) > 0) {
$this->image = 'http://grafikk.ukm.no/placeholder/person.jpg';
}
$this->company_name = get_the_author_meta('title', $this->id);
$this->login = $wpUser->user_login;
$this->nicename = $wpUser->nicename;
$this->user_email = $wpUser->user_email;
$this->url = $wpUser->url;
$this->registered = $wpUser->registered;
$this->display_name = $wpUser->display_name;
$this->firstname = $wpUser->firstname;
$this->lastname = $wpUser->lastname;
$this->nickname = $wpUser->nickname;
$this->description = $wpUser->description;
$this->facebook_url = get_the_author_meta('facebook', $this->id);
$this->title = get_the_author_meta('Title', $this->id);
$this->link = get_author_posts_url($this->id, $this->nicename);
}
示例8: thirdrail_entry_meta
function thirdrail_entry_meta()
{
echo '<div class="entry-meta">';
echo '<p class="byline"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" rel="author" class="author">' . get_the_author() . '</a>' . cats() . '</p>';
echo '<time class="updated date" datetime="' . get_the_time('c') . '">' . sprintf(__('%s', 'thirdrail'), get_the_date()) . '</time>';
echo '</div>';
}
示例9: sold_by_meta
/**
* Single product meta
*/
public static function sold_by_meta()
{
$vendor_id = get_the_author_meta('ID');
$sold_by_label = WC_Vendors::$pv_options->get_option('sold_by_label');
$sold_by = WCV_Vendors::is_vendor($vendor_id) ? sprintf('<a href="%s" class="wcvendors_cart_sold_by_meta">%s</a>', WCV_Vendors::get_vendor_shop_page($vendor_id), WCV_Vendors::get_vendor_sold_by($vendor_id)) : get_bloginfo('name');
echo apply_filters('wcvendors_cart_sold_by_meta', $sold_by_label) . $sold_by . '<br/>';
}
示例10: edd_wl_render_admin_columns
/**
* Render Wish List Columns
*
* @since 1.0
* @param string $column_name Column name
* @param int $post_id Download (Post) ID
* @return void
*/
function edd_wl_render_admin_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'edd_wish_list') {
$items = get_post_meta(get_the_ID(), 'edd_wish_list', true);
switch ($column_name) {
case 'downloads':
if ($items) {
echo count($items);
} else {
echo 0;
}
break;
case 'total':
echo edd_wl_get_list_total(get_the_ID());
break;
case 'list_author':
$post = get_post();
if (0 == $post->post_author) {
echo __('Guest', 'edd-wish-lists');
} else {
printf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'author' => get_the_author_meta('ID')), 'edit.php')), get_the_author());
}
break;
}
}
}
示例11: mur_block_editing_post
/**
* mur_block_editing_post()
*
* block post editing for different user
*/
function mur_block_editing_post()
{
$author_id_post = get_the_author_meta('ID');
$current_user = wp_get_current_user();
$author_role = $current_user->roles[0];
$author_id = $current_user->ID;
}
示例12: cp_ad_loop_meta
/**
* add the ad meta in the loop after the ad title
* @since 3.1
*/
function cp_ad_loop_meta()
{
if (is_page() || is_singular(APP_POST_TYPE)) {
return;
}
// don't do ad-meta on pages
global $post;
if ($post->post_type == 'page') {
return;
}
?>
<p class="post-meta">
<span class="folder"><?php
if ($post->post_type == 'post') {
the_category(', ');
} else {
echo get_the_term_list($post->ID, APP_TAX_CAT, '', ', ', '');
}
?>
</span> | <span class="owner"><?php
if (get_option('cp_ad_gravatar_thumb') == 'yes') {
appthemes_get_profile_pic(get_the_author_meta('ID'), get_the_author_meta('user_email'), 16);
}
the_author_posts_link();
?>
</span> | <span class="clock"><span><?php
echo appthemes_date_posted($post->post_date);
?>
</span></span>
</p>
<?php
}
示例13: uw_blogroll_shortcode
function uw_blogroll_shortcode($atts = array())
{
//allow pagebuilder widgets to run the shortcode, block all other posts to prevent infinite loops
if (get_post_type() == 'post' && !is_home()) {
return '';
}
$params = array_merge(array('excerpt' => 'true', 'trim' => 'false', 'image' => 'hide', 'author' => 'show', 'titletag' => 'h2', 'number' => 5), $atts);
if (!array_key_exists('numberposts', $params)) {
$params['numberposts'] = $params['number'];
}
$posts = get_posts($params);
foreach ($posts as $post) {
if (!stripos($post->post_content, '[blogroll')) {
//to prevent infinite loops in pagebuilder widgets
$postID = $post->ID;
$link = get_permalink($postID);
if (in_array($params['excerpt'], array('show', 'true'))) {
$excerpt = strlen($post->post_excerpt) > 0 ? $post->post_excerpt : apply_filters('widget_text', $post->post_content);
if (in_array($params['trim'], array('show', 'true'))) {
$excerpt = wp_trim_words($excerpt);
}
$excerpt = wpautop($excerpt);
//using apply_filters('the_content', $excerpt) causes an infinite loop
if (in_array($params['image'], array('show', 'true'))) {
$image = get_the_post_thumbnail($postID, 'thumbnail', array('style' => 'float:left;padding-right:10px;'));
$class = 'class="pull-left"';
}
}
$author = $params['author'] === 'show' ? '<p class="author-info">' . get_the_author_meta('display_name', $post->post_author) . '</p>' : '';
$postDate = get_the_time(get_option('date_format'), $postID);
$html .= "<li {$class}>{$image}<span><p class=\"date\">{$postDate}</p><" . $params['titletag'] . "><a href=\"{$link}\">{$post->post_title}</a></" . $params['titletag'] . ">{$author}{$excerpt}</span></li>";
}
}
return "<ul class=\"shortcode-blogroll\">{$html}</ul>";
}
示例14: qum_yim_handler
function qum_yim_handler($output, $form_location, $field, $user_id, $field_check_errors, $request_data)
{
$item_title = apply_filters('qum_' . $form_location . '_yim_item_title', qum_icl_t('plugin quick-user-manager-pro', 'default_field_' . $field['id'] . '_title_translation', $field['field-title']));
$item_description = qum_icl_t('plugin quick-user-manager-pro', 'default_field_' . $field['id'] . '_description_translation', $field['description']);
$input_value = '';
if ($form_location == 'edit_profile') {
$input_value = get_the_author_meta('yim', $user_id);
}
if (trim($input_value) == '') {
$input_value = $field['default-value'];
}
$input_value = isset($request_data['yim']) ? trim($request_data['yim']) : $input_value;
if ($form_location != 'back_end') {
$error_mark = $field['required'] == 'Yes' ? '<span class="qum-required" title="' . qum_required_field_error($field["field-title"]) . '">*</span>' : '';
if (array_key_exists($field['id'], $field_check_errors)) {
$error_mark = '<img src="' . QUM_PLUGIN_URL . 'assets/images/pencil_delete.png" title="' . qum_required_field_error($field["field-title"]) . '"/>';
}
$output = '
<label for="yim">' . $item_title . $error_mark . '</label>
<input class="text-input" name="yim" maxlength="' . apply_filters('qum_maximum_character_length', 70) . '" type="text" class="default_field_yim" id="yim" value="' . esc_attr(wp_unslash($input_value)) . '" />';
if (!empty($item_description)) {
$output .= '<span class="qum-description-delimiter">' . $item_description . '</span>';
}
}
return apply_filters('qum_' . $form_location . '_yim', $output, $form_location, $field, $user_id, $field_check_errors, $request_data);
}
示例15: matraman_lite_author
function matraman_lite_author()
{
global $post;
echo '<span class="author"> <i class="icon icon-gist-secret"></i>';
echo '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a>';
echo '</span> |';
}