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


PHP get_wp_user_avatar函数代码示例

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


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

示例1: foreach

foreach ((array) $sr as $u) {
    $g = get_user_meta($u['user_id'], 'user_grade', false);
    $l = get_user_meta($u['user_id'], 'last_name', false);
    //echo $u." ".$g[0]['name']." ".$l[0]."<br> ";
    $userid = $u['user_id'];
    //echo $userid;
    $context = get_user_meta($userid, 'user_job_title', true);
    if ($context == '') {
        $context = "staff";
    }
    $icon = "user";
    $user_info = get_userdata($userid);
    $userurl = site_url() . '/staff/' . $user_info->user_nicename;
    $displayname = get_user_meta($userid, 'first_name', true) . " " . get_user_meta($userid, 'last_name', true);
    if (function_exists('get_wp_user_avatar')) {
        $image_url = get_wp_user_avatar($userid, 130, 'left');
    } else {
        $image_url = get_avatar($userid, 130);
    }
    $image_url = str_replace('avatar ', 'avatar img ', $image_url);
    if ($directorystyle == 1) {
        $avatarhtml = str_replace('avatar-66', 'avatar-66 pull-left indexcard-avatar img img-circle', get_avatar($userid, 66));
    } else {
        $avatarhtml = str_replace('avatar-66', 'avatar-66 pull-left indexcard-avatar img ', get_avatar($userid, 66));
    }
    $gradedisplay = '';
    if ($showgrade) {
        $gradecode = get_user_meta($userid, 'user_grade', true);
        $gradecode = $gradecode['grade_code'];
        $gradedisplay = "<span class='badge pull-right'>" . $gradecode . "</span>";
    }
开发者ID:MrBoy31,项目名称:helpful-intranet,代码行数:31,代码来源:search-staff.php

示例2: json_encode

if (empty($comment)) {
    echo json_encode(array('errors' => 'Please enter a comment'));
    exit;
}
if ($quote_id === 0) {
    echo json_encode(array('errors' => 'Sorry, this form submission is not allowed (invalid quote ID).'));
    exit;
}
// get commenter info
$current_user = wp_get_current_user();
// set up comment properties
$comment_parameters = array('comment_author' => $current_user->display_name, 'comment_author_email' => $current_user->user_email, 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_author_url' => $current_user->user_url, 'comment_content' => $comment, 'comment_date' => current_time('mysql'), 'comment_parent' => 0, 'comment_post_ID' => $quote_id, 'user_id' => $current_user->ID);
// add the comment
if ($comment_added_id = wp_insert_comment($comment_parameters)) {
    wp_notify_postauthor($comment_added_id);
    if (!($comment_avatar = get_wp_user_avatar($current_user->ID, 48))) {
        $comment_avatar = DEFAULT_THUMBNAIL;
    }
    $comment_html = '
	<li>' . $comment_avatar . $current_user->display_name . '<time class="timeago" datetime="' . date('c') . '">' . date('F j, Y') . '</time>
		<p>' . $comment . '</p>
	</li>';
    echo json_encode(array('comment_html' => $comment_html));
} else {
    echo json_encode(array('errors' => 'There was a problem adding your comment'));
}
exit;
/*
function ajaxify_comments($comment_ID, $comment_status){
	if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
	//If AJAX Request Then
开发者ID:vossavant,项目名称:phoenix,代码行数:31,代码来源:comment.php

示例3: getUserListing

function getUserListing($curuser)
{
    $html = '<div class="uyd-user ' . ($curuser->ID === 'GUEST' ? 'guest' : '') . '">';
    /* Gravatar */
    if (function_exists('get_wp_user_avatar')) {
        $display_gravatar = get_wp_user_avatar($curuser->user_email, 32);
    } else {
        $display_gravatar = get_avatar($curuser->user_email, 32);
        if ($display_gravatar === false) {
            //Gravatar is disabled, show default image.
            $display_gravatar = '<img src="' . USEYOURDRIVE_ROOTPATH . '/css/images/usericon.png"/>';
        }
    }
    $html .= "<div class=\"uyd-avatar\"><a title=\"{$curuser->display_name}\">{$display_gravatar}</a></div>\n";
    $html .= "<div class=\"uyd-userinfo\" data-userid=\"" . $curuser->ID . "\">";
    /* name */
    $html .= "<div class=\"uyd-name\"><a href=\"" . ($curuser->ID === 'GUEST' ? '#' : get_edit_user_link($curuser->ID)) . "\"title=\"{$curuser->display_name}\">{$curuser->display_name}</a></div>\n";
    /* Current link */
    if ($curuser->ID === 'GUEST') {
        $curfolder = get_site_option('use_your_drive_guestlinkedto');
    } else {
        $curfolder = get_user_option('use_your_drive_linkedto', $curuser->ID);
    }
    $nolink = true;
    if (empty($curfolder) || !is_array($curfolder) || !isset($curfolder['foldertext'])) {
        $curfolder = __('Not yet linked to a folder', 'useyourdrive');
    } else {
        $curfolder = $curfolder['foldertext'];
        $nolink = false;
    }
    $html .= "<div class=\"uyd-linkedto\">{$curfolder}</div>\n";
    $html .= "<input class='uyd-linkbutton button-primary' type='submit' title='" . __('Link to folder', 'useyourdrive') . "' value='" . __('Link to folder', 'useyourdrive') . "'>";
    $html .= "<input class='uyd-unlinkbutton button-secondary " . ($nolink ? 'disabled' : '') . "' type='submit' title='" . __('Remove link', 'useyourdrive') . "' value='" . __('Remove link', 'useyourdrive') . "'>";
    $html .= "</div>";
    $html .= '</div>';
    return $html;
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:37,代码来源:UseyourDrive_LinkUsers.php

示例4: the_archive_title

		<main id="main" class="site-main col-md-12" role="main">

		<?php 
if (have_posts()) {
    ?>

			<header class="page-header col-md-12">

				<?php 
    the_archive_title('', '</h1>');
    //This has a filter, found in functions.php, that determines the formatting of the prefix.  This also controls which .section-title appears above the archive the_archive_title
    the_archive_description('<div class="taxonomy-description">', '</div>');
    ?>
				<div class="taxonomy-description author-bio">
					<?php 
    echo get_wp_user_avatar(get_the_author_meta('ID'), 96, 'left');
    echo get_the_author_meta('description');
    ?>
</div>
						<h2 class="widget-title" style="border:none;">Publications by <?php 
    echo get_the_author_meta('first_name');
    ?>
</h2>
			</header><!-- .page-header -->

	<div class="col-md-8">
			<?php 
    /* Start the Loop */
    ?>
			<?php 
    while (have_posts()) {
开发者ID:WYSAC,项目名称:wy-tobacco-theme-2,代码行数:31,代码来源:author.php

示例5: wpua_shortcode

 function wpua_shortcode($atts, $content)
 {
     global $blog_id, $wpdb;
     // Set shortcode attributes
     extract(shortcode_atts(array('user' => "", 'size' => '96', 'align' => "", 'link' => "", 'target' => ""), $atts));
     // Find user by ID, login, slug, or e-mail address
     if (!empty($user)) {
         $user = is_numeric($user) ? get_user_by('id', $user) : get_user_by('login', $user);
         $user = empty($user) ? get_user_by('slug', $user) : $user;
         $user = empty($user) ? get_user_by('email', $user) : $user;
     }
     // Get user ID
     $id_or_email = !empty($user) ? $user->ID : "";
     // Check if link is set
     if (!empty($link)) {
         // CSS class is same as link type, except for URL
         $link_class = $link;
         // Open in new window
         $target_link = !empty($target) ? ' target="' . $target . '"' : "";
         if ($link == 'file') {
             // Get image src
             $image_link = get_wp_user_avatar_src($id_or_email, 'original', $align);
         } elseif ($link == 'attachment') {
             // Get attachment URL
             $image_link = get_attachment_link(get_the_author_meta($wpdb->get_blog_prefix($blog_id) . 'user_avatar', $id_or_email));
         } else {
             // URL
             $image_link = $link;
             $link_class = 'custom';
         }
         // Wrap the avatar inside the link
         $avatar = '<a href="' . $image_link . '" class="wp-user-avatar-link wp-user-avatar-' . $link_class . '"' . $target_link . '>' . get_wp_user_avatar($id_or_email, $size, $align) . '</a>';
     } else {
         // Get WPUA as normal
         $avatar = get_wp_user_avatar($id_or_email, $size, $align);
     }
     return $avatar;
 }
开发者ID:par-orillonsoft,项目名称:elearning-wordpress,代码行数:38,代码来源:wp-user-avatar.php

示例6: wpua_shortcode

 /**
  * Display shortcode
  * @since 1.4
  * @param array $atts
  * @param string $content
  * @uses array $_wp_additional_image_sizes
  * @uses array $all_sizes
  * @uses int $blog_id
  * @uses object $post
  * @uses object $wpdb
  * @uses do_shortcode()
  * @uses get_attachment_link()
  * @uses get_blog_prefix()
  * @uses get_option()
  * @uses get_user_by()
  * @uses get_query_var()
  * @uses get_the_author_meta()
  * @uses get_user_meta()
  * @uses get_wp_user_avatar_src()
  * @uses get_wp_user_avatar()
  * @uses image_add_caption()
  * @uses is_author()
  * @uses shortcode_atts()
  * @return string 
  */
 public function wpua_shortcode($atts, $content = null)
 {
     global $all_sizes, $blog_id, $post, $wpdb;
     // Set shortcode attributes
     extract(shortcode_atts(array('user' => "", 'size' => '96', 'align' => "", 'link' => "", 'target' => ""), $atts));
     // Find user by ID, login, slug, or e-mail address
     if (!empty($user)) {
         $user = is_numeric($user) ? get_user_by('id', $user) : get_user_by('login', $user);
         $user = empty($user) ? get_user_by('slug', $user) : $user;
         $user = empty($user) ? get_user_by('email', $user) : $user;
     } else {
         // Find author's name if id_or_email is empty
         $author_name = get_query_var('author_name');
         if (is_author()) {
             // On author page, get user by page slug
             $user = get_user_by('slug', $author_name);
         } else {
             // On post, get user by author meta
             $user_id = get_the_author_meta('ID');
             $user = get_user_by('id', $user_id);
         }
     }
     // Numeric sizes leave as-is
     $get_size = $size;
     // Check for custom image sizes if there are captions
     if (!empty($content)) {
         if (in_array($size, $all_sizes)) {
             if (in_array($size, array('original', 'large', 'medium', 'thumbnail'))) {
                 $get_size = $size == 'original' ? get_option('large_size_w') : get_option($size . '_size_w');
             } else {
                 $get_size = $_wp_additional_image_sizes[$size]['width'];
             }
         }
     }
     // Get user ID
     $id_or_email = !empty($user) ? $user->ID : 'unknown@gravatar.com';
     // Check if link is set
     if (!empty($link)) {
         // CSS class is same as link type, except for URL
         $link_class = $link;
         if ($link == 'file') {
             // Get image src
             $link = get_wp_user_avatar_src($id_or_email, 'original');
         } elseif ($link == 'attachment') {
             // Get attachment URL
             $link = get_attachment_link(get_the_author_meta($wpdb->get_blog_prefix($blog_id) . 'user_avatar', $id_or_email));
         } else {
             // URL
             $link_class = 'custom';
         }
         // Open in new window
         $target_link = !empty($target) ? ' target="' . $target . '"' : "";
         // Wrap the avatar inside the link
         $html = '<a href="' . $link . '" class="wp-user-avatar-link wp-user-avatar-' . $link_class . '"' . $target_link . '>' . get_wp_user_avatar($id_or_email, $get_size, $align) . '</a>';
     } else {
         $html = get_wp_user_avatar($id_or_email, $get_size, $align);
     }
     // Check if caption is set
     if (!empty($content)) {
         // Get attachment ID
         $wpua = get_user_meta($id_or_email, $wpdb->get_blog_prefix($blog_id) . 'user_avatar', true);
         // Clean up caption
         $content = trim($content);
         $content = preg_replace('/\\r|\\n/', "", $content);
         $content = preg_replace('/<\\/p><p>/', "", $content, 1);
         $content = preg_replace('/<\\/p><p>$/', "", $content);
         $content = str_replace('</p><p>', "<br /><br />", $content);
         $avatar = do_shortcode(image_add_caption($html, $wpua, $content, $title = "", $align, $link, $get_size, $alt = ""));
     } else {
         $avatar = $html;
     }
     return $avatar;
 }
开发者ID:tuanlibra,项目名称:thptxuanang,代码行数:98,代码来源:class-wp-user-avatar-shortcode.php

示例7: TimberPost

<?php

$post = new TimberPost();
$data = Timber::get_context();
$related_posts = yarpp_get_related();
if (!empty($related_posts)) {
    foreach ($related_posts as $related_post) {
        $timber_related_posts[] = Timber::get_post($related_post->ID);
    }
    $data['related_posts'] = $timber_related_posts;
}
$data['post'] = $post;
$data['author_image'] = get_lazyloadxt_html(get_wp_user_avatar($post->author->ID, 150));
Timber::render(array('single.twig'), $data);
开发者ID:saplingdigitalltd,项目名称:thefoodrush,代码行数:14,代码来源:single.php

示例8:

<?php

/*
 *	QUOTEBOARD
 *	Comment Form - loaded in single-quote.php
 */
// get avatar (relies on WP User Avatar plugin)
if (!($current_user_avatar = get_wp_user_avatar(get_current_user_id(), 'thumb-small'))) {
    $current_user_avatar = DEFAULT_THUMBNAIL;
}
if (have_comments()) {
    ?>

<section class="comment box">
	<div class="bubble">
		<h4>Comments</h4>
		<span class="box-meta">
			<?php 
    comments_number('No comments yet', '1 comment so far', '% comments so far');
    ?>
		</span>

		<?php 
    if (have_comments()) {
        echo '<ul id="comment-list">';
        wp_list_comments(array('callback' => 'qb_comments'));
        echo '</ul>';
    }
    ?>
	</div> <!-- // bubble -->
</section> <!-- // comments -->
开发者ID:vossavant,项目名称:phoenix,代码行数:31,代码来源:comments.php

示例9: get_the_permalink

    $quote_board_permalink .= '<a href="' . get_the_permalink($board) . '">' . get_the_title($board) . '</a>';
}
// update custom fields
if ($quote_updated) {
    add_post_meta($quote_added_id, 'quote_author', $quote_attributed_to_id);
    add_post_meta($quote_added_id, '_quote_author', 'field_507658884a81f');
    add_post_meta($quote_added_id, 'quote_character', $quote_character_id);
    add_post_meta($quote_added_id, '_quote_character', 'field_56c724e28d8b8');
    add_post_meta($quote_added_id, 'quote_source', $quote_sourced_to_id);
    add_post_meta($quote_added_id, '_quote_source', 'field_507658884b202');
    add_post_meta($quote_added_id, 'quote_board', $quote_boards);
    add_post_meta($quote_added_id, '_quote_board', 'field_5077ae14b09b9');
    add_post_meta($quote_added_id, 'quote_link', $quote_source_info);
    add_post_meta($quote_added_id, '_quote_link', 'field_568d2f6302c1e');
    // return params for jQuery
    echo json_encode(array('added_by' => $current_user_id, 'author_id' => $quote_attributed_to_id, 'board_id' => $quote_boards, 'quote_id' => $quote_added_id, 'home_url' => home_url(), 'avatar' => get_wp_user_avatar($current_user_id, 80), 'quote_url' => get_permalink($quote_added_id), 'username' => get_user_by('id', $current_user_id)->user_nicename, 'datetime' => date('c'), 'quote' => wp_unslash(nl2br($quote_text_hashless)), 'privacy' => $quote_status, 'permalink' => $quote_board_permalink));
    exit;
} else {
    echo json_encode(array('permalink' => false));
}
/*


//test

echo json_encode(
	array(
		'hashed quote' => $quote_text_hashed,
		'attributed to' => $quote_attributed_to,
		'attributed to ID' => $quote_attributed_to_id,
		'board id' => $quote_boards,
开发者ID:vossavant,项目名称:phoenix,代码行数:31,代码来源:add-quote.php

示例10: get_field

// fetch character
$character = get_field('quote_character');
// fetch quote contributor; set to "You" for quotes added by current user
$contributor = get_the_author_meta('display_name');
if ($contributor == $current_user->display_name) {
    $contributor = 'You';
    $quote_class = ' yours';
    $home_url = '';
} else {
    $quote_class = '';
    $home_url = 'author/' . get_the_author_meta('user_nicename');
}
// fetch quote board
$board_id = get_post_meta($post->ID, 'quote_board', true);
// get avatar (relies on WP User Avatar plugin)
if (!($author_avatar = get_wp_user_avatar($author['ID'], 60))) {
    $author_avatar = get_default_thumbnail('thumb-small');
}
// use character image whenever possible
if ($character) {
    if ($character_image_id = get_field('character_image', $character->ID)) {
        $author_avatar = wp_get_attachment_image($character_image_id, 'thumb-small');
    }
}
?>

<article class="quote box<?php 
echo $quote_class;
?>
" data-author="<?php 
echo $author['ID'];
开发者ID:vossavant,项目名称:phoenix,代码行数:31,代码来源:individual-quote.php

示例11: WP_Query

$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('cat=' . $temp . '&showposts=9' . '&paged=' . $paged);
?>
        <ul class="interview-list">
            <?php 
while ($wp_query->have_posts()) {
    $wp_query->the_post();
    ?>
                <li class="single-news">
                    <a href="<?php 
    the_permalink();
    ?>
">
                    <div class="thumb"> <?php 
    echo get_wp_user_avatar($authordata->ID, 181, 'left');
    ?>
</div>

                    <div class="posts-info">
                        <?php 
    $author = get_the_author();
    ?>
                        <?php 
    $user_description = get_the_author_meta('description', $authordata->ID);
    ?>
                        <h2><span class="author-name"><?php 
    echo $author;
    ?>
</span></h2>
                        <h4><?php 
开发者ID:Alexander-smirnov,项目名称:infomist,代码行数:31,代码来源:first-face.php

示例12: get_author_avatar_url

function get_author_avatar_url($id)
{
    $get_avatar = get_wp_user_avatar($id);
    preg_match('/src\\s*=\\s*"(.+?)"/', $get_avatar, $matches);
    return $matches[1];
}
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:6,代码来源:functions.php

示例13: home_url

// 		'posts_per_page'	=> 10, //RESULTS_PER_PAGE,
// 		'post_type' 		=> 'quote'
// 	)
// );
include TEMPLATEPATH . '/loop-quotes.php';
echo '<a class="btn right" href="' . home_url() . '/quotes">More Quotes &raquo;</a>
			</div>

			<div class="flex-child flex-40">
				<h3 style="margin-left: 30px;">Notable Quoters</h3>';
if ($curated_authors = get_field('curated_authors', 'option')) {
    foreach ($curated_authors as $key => $author) {
        foreach ($author['author'] as $key => $value) {
            // I don't know why this nested foreach is needed...
            // get author avatar
            if (!($author_avatar = get_wp_user_avatar($value['ID'], 'thumbnail'))) {
                $author_avatar = get_default_thumbnail('thumbnail');
            }
            // get user background
            if ($background_id = get_user_meta($value['ID'], 'user_background', true)) {
                $upload_directory = wp_upload_dir();
                $background_src = $wpdb->get_var("SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = '" . $background_id . "' AND meta_key = '_wp_attached_file'");
                $author_cover_photo = $upload_directory['baseurl'] . '/' . $background_src;
            } else {
                $author_cover_photo = DEFAULT_BACKGROUND;
            }
            // get author quote counts
            $author_quote_count = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key = 'quote_author' AND meta_value = '" . $value['ID'] . "'");
            echo '<div class="profile static" data-link="' . home_url('/') . 'author/' . $value['user_nicename'] . '">
								<div class="cover" style="background: url(' . $author_cover_photo . ') center no-repeat;">' . $author_avatar . '<div>
										<div>
开发者ID:vossavant,项目名称:phoenix,代码行数:31,代码来源:front-page.php

示例14: get_bloginfo

		<li data-email="' . $member_email . '" data-id="' . $member['board_members_user']['ID'] . '">
			<a href="' . get_bloginfo('home') . '/author/' . $member['board_members_user']['user_nicename'] . '" target="_blank">' . $member_avatar . '
				<span>' . $member['board_members_user']['display_name'] . '</span>' . '<span>' . ($user_id != $member['board_members_user']['ID'] ? 'Invited by you' : 'You created this board') . '</span>
			</a>' . ($user_id != $member['board_members_user']['ID'] ? '<a class="delete remove-collab" href="">(remove)</a>' : '') . '
		</li>';
    }
}
// check for pending collaborators (invitations sent by board curator but not yet accepted)
if ($pending_invitees = $wpdb->get_results("SELECT invite_email, is_member FROM wp_qb_invite_codes WHERE board_id = '{$board_id}'")) {
    foreach ($pending_invitees as $pending) {
        // get info for existing members
        if ($pending->is_member) {
            $existing_member = get_user_by('email', $pending->invite_email);
            $collaborators .= '
			<li class="awaiting-invite" data-email="' . $pending->invite_email . '" data-id="' . $existing_member->ID . '">
			<a href="' . get_bloginfo('home') . '/author/' . $existing_member->user_nicename . '" target="_blank">' . get_wp_user_avatar($existing_member->ID, 48) . '
				<span>' . $existing_member->display_name . '</span>
				<span>Invitation Sent &ndash; Awaiting Response</span>
			</a></li>';
            // . ( $user_id != $member['board_members_user']['ID'] ? '<a class="delete remove-pending-collab" href="">(remove)</a>' : '' ) . '
            //</li>';
            // else the pending invite is for a non-member
        } else {
            $collaborators .= '
			<li class="awaiting-invite" data-email="' . $pending->invite_email . '">
				<div class="ico email invite-email"></div>
				<span>' . $pending->invite_email . '</span>
				<span>Invitation Sent &ndash; Awaiting Response</span>
			</a></li>';
        }
    }
开发者ID:vossavant,项目名称:phoenix,代码行数:31,代码来源:modal-board-invite.php

示例15: while

if ($recentQuery->have_posts()) {
    while ($recentQuery->have_posts()) {
        $recentQuery->the_post();
        ?>
				<h3>Latest News</h3>
				<h2><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
				<div class="author">
					<div class="avatarWrapper">
						<?php 
        echo get_wp_user_avatar();
        ?>
					</div>

					<span class="authorName">
						By <?php 
        the_author();
        ?>
					</span>
				</div>
				<?php 
        the_content('Read More &raquo;');
        ?>
			<?php 
    }
}
开发者ID:huwcarwyn,项目名称:hba,代码行数:31,代码来源:index.php


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