protected function comment($comment, $depth, $args) { // each comment markup, without </li>! $classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : ''); // get typical wp comment classes and if comment belong post autor add "author-comment" class echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n"; // parent tag with classes and uniq id echo '<div id="comment-' . get_comment_ID() . '">' . "\n"; // anchor element with this id need to anchor links on comments works echo get_avatar($comment, 64) . "\n"; // show avatar with size 64x64 px echo '<p class="meta">Posted by: ' . get_comment_author() . "\n"; // comment autor name echo ' ' . get_comment_author_email(); // comment autor email echo ' ' . get_comment_author_url(); // comment autor url echo ' On ' . get_comment_date('F j, Y') . ' at ' . get_comment_time() . '</p>' . "\n"; // date and time of comment creating if ('0' == $comment->comment_approved) { echo '<em class="comment-awaiting-moderation">Your comment is awaiting moderation</em>' . "\n"; } // if comment is not approved notify of it comment_text() . "\n"; // display comment text $reply_link_args = array('depth' => $depth, 'reply_text' => 'Reply on it', 'login_text' => 'You must be logged to post comments'); echo get_comment_reply_link(array_merge($args, $reply_link_args)); // display reply link echo '</div>' . "\n"; // anchor element end }
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"; // закрываем див }
/** * * Woo User Menu */ function user_menu() { $_Twoot_Woo = new Twoot_Woo(); $url = $_Twoot_Woo->shop_urls(); $user_data = get_userdata(get_current_user_id()); $avatar = get_option('show_avatars') ? '<span class="avatar">' . get_avatar(get_current_user_id(), 20) . '</span>' : ''; $tag = get_option('permalink_structure') == false ? '&' : '?'; $html = '<nav id="woo-user-menu">'; $html .= '<ul class="sf-menu clearfix">'; if (is_user_logged_in()) { $html .= '<li class="my-account"><a href="' . $url['account_overview'] . '">' . $avatar . esc_attr__('Howdy, ', 'Twoot') . $user_data->display_name . '</a>'; $html .= '<ul>'; $html .= '<li class="account-change-pw"><a href="' . $url['account_change_pw'] . '">' . esc_attr__('Change Password', 'Twoot') . '</a></li>'; $html .= '<li class="account-edit-adress"><a href="' . $url['account_edit_adress'] . '">' . esc_attr__('Edit Address', 'Twoot') . '</a></li>'; $html .= '<li class="account-view-order"><a href="' . $url['account_view_order'] . '">' . esc_attr__('View Order', 'Twoot') . '</a></li>'; $html .= '<li class="cart"><a href="' . $url['cart'] . '">' . esc_attr__('Shopping Cart', 'Twoot') . '</a></li>'; $html .= '<li class="checkout"><a href="' . $url['checkout'] . '">' . esc_attr__('Checkout', 'Twoot') . '</a></li>'; $html .= '</ul>'; $html .= '</li>'; $html .= '<li class="logout last"><a href="' . $url['logout'] . '">' . esc_attr__('Sign Out', 'Twoot') . '</a></li>'; } else { if (get_option('users_can_register') && get_option('woocommerce_enable_myaccount_registration') == 'yes') { $html .= '<li class="register"><a href="' . $url['register'] . $tag . 'user_account=register">' . esc_attr__('Create Account', 'Twoot') . '</a></li>'; } $html .= '<li class="login last"><a href="' . $url['account_overview'] . $tag . 'user_account=login">' . esc_attr__('Sign In', 'Twoot') . '</a></li>'; } $html .= '</ul>'; $html .= '</nav>'; return $html; }
function garland_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; extract($args, EXTR_SKIP); ?> <li <?php comment_class(empty($args['has_children']) ? '' : 'parent'); ?> id="comment-<?php comment_ID(); ?> "> <div id="div-comment-<?php comment_ID(); ?> "> <span class="comment-author vcard"> <?php if ($args['avatar_size'] != 0) { echo get_avatar($comment, $args['avatar_size']); } ?> <?php printf(__('<cite class="fn">%s</cite> Says:', 'kubrick'), get_comment_author_link()); ?> </span> <?php if ($comment->comment_approved == '0') { ?> <em><?php _e('Your comment is awaiting moderation.', 'kubrick'); ?> </em> <?php } ?> <br /> <small class="comment-meta commentmetadata"><a href="#comment-<?php comment_ID(); ?> " title=""><?php printf(__('%1$s at %2$s', 'kubrick'), get_comment_date(), get_comment_time()); ?> </a> <?php edit_comment_link(__('edit', 'kubrick'), ' ', ''); ?> </small> <?php comment_text(); ?> <div class="reply"> <?php comment_reply_link(array_merge($args, array('add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> </div> <?php }
/** * Echo the widget content. * * @param array $args Display arguments including `before_title`, `after_title`, * `before_widget`, and `after_widget`. * @param array $instance The settings for the particular instance of the widget. */ function widget($args, $instance) { // Merge with defaults. $instance = wp_parse_args((array) $instance, $this->defaults); echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title']; } $text = ''; if (!empty($instance['alignment'])) { $text .= '<span class="align' . esc_attr($instance['alignment']) . '">'; } $text .= get_avatar($instance['user'], $instance['size']); if (!empty($instance['alignment'])) { $text .= '</span>'; } if ('text' === $instance['author_info']) { $text .= $instance['bio_text']; } else { $text .= get_the_author_meta('description', $instance['user']); } $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : ''; echo wpautop($text); // If posts link option checked, add posts link to output. $display_name = get_the_author_meta('display_name', $instance['user']); $user_name = !empty($display_name) && genesis_a11y('screen-reader-text') ? '<span class="screen-reader-text">' . $display_name . ': </span>' : ''; if ($instance['posts_link']) { printf('<div class="posts_link posts-link"><a href="%s">%s%s</a></div>', get_author_posts_url($instance['user']), $user_name, __('View My Blog Posts', 'genesis')); } echo $args['after_widget']; }
/** * HTML for Gravatar Hovercard setting */ function grofiles_setting_callback() { global $current_user; $checked = 'disabled' == get_option( 'gravatar_disable_hovercards' ) ? '' : 'checked="checked" '; echo "<label id='gravatar-hovercard-options'><input {$checked}name='gravatar_disable_hovercards' id='gravatar_disable_hovercards' type='checkbox' value='enabled' class='code' /> " . __( "View people's profiles when you mouse over their Gravatars", 'jetpack' ) . "</label>"; ?> <style type="text/css"> #grav-profile-example img { float: left; } #grav-profile-example span { padding: 0 1em; } </style> <script type="text/javascript"> // <![CDATA[ jQuery( function($) { var tr = $( '#gravatar_disable_hovercards' ).change( function() { if ( $( this ).is( ':checked' ) ) { $( '#grav-profile-example' ).slideDown( 'fast' ); } else { $( '#grav-profile-example' ).slideUp( 'fast' ); } } ).parents( 'tr' ); var ftr = tr.parents( 'table' ).find( 'tr:first' ); if ( ftr.size() && !ftr.find( '#gravatar_disable_hovercards' ).size() ) { ftr.after( tr ); } } ); // ]]> </script> <p id="grav-profile-example" class="hide-if-no-js"<?php if ( !$checked ) echo ' style="display:none"'; ?>><?php echo get_avatar( $current_user->ID, 64 ); ?> <span><?php _e( 'Put your mouse over your Gravatar to check out your profile.', 'jetpack' ); ?> <br class="clear" /></span></p> <?php }
function revert_to_default_wp_avatar($img, $params, $item_id) { // we are concerned only with users if ($params['object'] != 'user') { return $img; } //check if user has uploaded an avatar //if not then revert back to wordpress core get_avatar method //remove the filter first, or else it will go in infinite loop remove_filter('bp_core_fetch_avatar', 'revert_to_default_wp_avatar', 80, 3); if (!userpro_user_has_avatar($item_id)) { $width = $params['width']; // Set image width if (false !== $width) { $img_width = $width; } elseif ('thumb' == $type) { $img_width = bp_core_avatar_thumb_width(); } else { $img_width = bp_core_avatar_full_width(); } $img = get_avatar($item_id, $img_width); } //add the filter back again add_filter('bp_core_fetch_avatar', 'revert_to_default_wp_avatar', 80, 3); return $img; }
/** * Widget Output. * @see WP_Widget::widget() */ public function widget($args, $instance) { global $wpdb; extract($args, EXTR_SKIP); $number = (int) $instance['number']; if (1 > $number) { $number = 5; } elseif (20 < $number) { $number = 20; } echo $before_widget; if (!empty($instance['title'])) { echo $before_title . $instance['title'] . $after_title; } echo '<ul>'; $subquery = aoc_roles_subquery(); $query = "SELECT ID, user_login, display_name FROM ( {$subquery} ) AS usr " . "ORDER BY user_registered DESC " . "LIMIT 0,{$number};"; $users = $wpdb->get_results($query); foreach ($users as $user) { echo '<li>'; if ($instance['avatar']) { echo get_avatar($user->ID, $instance['avatar-size']); } echo '<a href="' . aoc_profile_link(urlencode($user->user_login)) . '">' . $user->display_name . '</a></li>'; } echo '</ul>'; echo $after_widget; }
function widget($args, $instance) { extract($args, EXTR_SKIP); $instance = wp_parse_args((array) $instance, array('title' => __('Blog Authors', 'academy'), 'number' => '6', 'order' => 'registered')); $orderdir = 'DESC'; if ($instance['order'] == 'display_name') { $orderdir = 'ASC'; } $title = apply_filters('widget_title', empty($instance['title']) ? __('Blog Authors', 'academy') : $instance['title'], $instance, $this->id_base); $out = $before_widget; $out .= $before_title . $title . $after_title; $counter = 0; $users = get_users(array('number' => $instance['number'], 'orderby' => $instance['order'], 'order' => $orderdir)); $out .= '<div class="users-listing">'; foreach ($users as $user) { $name = trim($user->first_name . ' ' . $user->last_name); $counter++; $out .= '<div class="user-image '; if ($counter == 3) { $out .= 'last'; } $out .= '"><div class="bordered-image">'; $out .= '<a title="' . $name . '" href="' . get_author_posts_url($user->ID) . '">' . get_avatar($user->ID) . '</a>'; $out .= '</div></div>'; if ($counter == 3) { $out .= '<div class="clear"></div>'; $counter = 0; } } $out .= '</div>'; $out .= $after_widget; echo $out; }
function format_comment($comment, $args, $depth) { echo '<div '; comment_class(); echo ' id="li-comment-'; comment_ID(); echo '"> <div class="row-fluid"> <div class="span9"> <p>'; comment_text(); echo '</p> </div> <div class="span3">'; echo get_avatar($comment->comment_author_email, 60); echo '<h6> <a href="'; comment_author_url(); echo '">'; comment_author(); echo '</a> </h6> <small>'; printf(__('%1$s', DOMAIN), get_comment_date(), get_comment_time()); echo '</small> </div> </div> </div>'; }
function listItem($email) { global $DOPBSP; $html = array(); $user = get_userdata($email->user_id); // Get data about the user who created the emails. array_push($html, '<li class="item" id="DOPBSP-email-ID-' . $email->id . '" onclick="DOPBSPEmail.display(' . $email->id . ')">'); array_push($html, ' <div class="header">'); /* * Display email ID. */ array_push($html, ' <span class="id">ID: ' . $email->id . '</span>'); /* * Display data about the user who created the email. */ if ($email->user_id > 0) { array_push($html, ' <span class="header-item avatar">' . get_avatar($email->user_id, 17)); array_push($html, ' <span class="info">' . $DOPBSP->text('EMAILS_CREATED_BY') . ': ' . $user->data->display_name . '</span>'); array_push($html, ' <br class="DOPBSP-clear" />'); array_push($html, ' </span>'); } array_push($html, ' <br class="DOPBSP-clear" />'); array_push($html, ' </div>'); array_push($html, ' <div class="name">' . $email->name . '</div>'); array_push($html, '</li>'); return implode('', $html); }
function framework_comment_avatar($avatar = true, $gravatar_size = 50) { $author = get_comment_author(); $url = get_comment_author_url(); if (!empty($url) || 'http://' == !$url) { $uri = ' href="' . $url . '" '; } else { $uri = NULL; } if ($avatar) { // Get author's gavatar $gravatar_email = get_comment_author_email(); $gravatar_size = apply_filters('framework_gravatar_size', (int) $gravatar_size); // Available filter: framework_gravatar_size $gravatar = get_avatar($gravatar_email, $gravatar_size); // get the $src data from $gavatar if (preg_match('/src=\'(.*?)\'/i', $gravatar, $matches)) { $src = $matches[1]; } // Rebuild Gravatar link because get_avatar() produces invalid code :/ (P.S. adds "gravatar" class) $output = "<a class=\"avatar-link\"{$uri}><img class=\"avatar gravatar gravatar-{$gravatar_size}\" alt=\"{$author}'s Gravatar\" src=\"{$src}\" width=\"{$gravatar_size}\" height=\"{$gravatar_size}\" /></a>"; return apply_filters('framework_comment_avatar', (string) $output); // Available filter: framework_comment_avatar } }
function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <div id="comment-<?php comment_ID(); ?> "> <div class="comment-author vcard"> <?php echo get_avatar($comment, $size = '40'); ?> <?php /* printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) */ ?> <cite class="fn"><?php comment_author_link(); ?> </cite> <span class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars(get_comment_link($comment->comment_ID)); ?> "><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()); ?> </a><?php edit_comment_link(__('(Edit)'), ' ', ''); ?> </span> </div> <?php if ($comment->comment_approved == '0') { ?> <em class="approved"><?php _e('Your comment is awaiting moderation.'); ?> </em> <br /> <?php } ?> <?php comment_text(); ?> <div class="reply"> <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> </div> <?php }
function listItem($extra) { global $DOPBSP; $html = array(); $user = get_userdata($extra->user_id); // Get data about the user who created the extras. array_push($html, '<li class="dopbsp-item" id="DOPBSP-extra-ID-' . $extra->id . '" onclick="DOPBSPBackEndExtra.display(' . $extra->id . ')">'); array_push($html, ' <div class="dopbsp-header">'); /* * Display extra ID. */ array_push($html, ' <span class="dopbsp-id">ID: ' . $extra->id . '</span>'); /* * Display data about the user who created the extra. */ if ($extra->user_id > 0) { array_push($html, ' <span class="dopbsp-header-item dopbsp-avatar">' . get_avatar($extra->user_id, 17)); array_push($html, ' <span class="dopbsp-info">' . $DOPBSP->text('EXTRAS_CREATED_BY') . ': ' . $user->data->display_name . '</span>'); array_push($html, ' <br class="dopbsp-clear" />'); array_push($html, ' </span>'); } array_push($html, ' <br class="dopbsp-clear" />'); array_push($html, ' </div>'); array_push($html, ' <div class="dopbsp-name">' . ($extra->name == '' ? ' ' : $extra->name) . '</div>'); array_push($html, '</li>'); return implode('', $html); }
function widget($args, $instance) { $title = $instance['title']; $bio = $instance['bio']; $custom_email = $instance['custom_email']; $avatar_size = preg_replace("/[^0-9]/", "", $instance['avatar_size']); if (!$avatar_size) { $avatar_size = 48; } $avatar_align = $instance['avatar_align']; if (!$avatar_align) { $avatar_align = 'left'; } $read_more_text = $instance['read_more_text'] ? $instance['read_more_text'] : 'Read more'; $read_more_url = $instance['read_more_url']; echo ts_essentials_escape($args['before_widget']); if (!empty($title)) { echo ts_essentials_escape($args['before_title'] . apply_filters('widget_title', $title) . $args['after_title']); } echo '<div class="blog-author clearfix">'; $avatar = $custom_email ? '<span class="align' . esc_attr($avatar_align) . '">' . get_avatar($custom_email, $avatar_size) . '</span>' : ''; ?> <p><?php echo wp_kses_post($avatar . $bio); ?> </p> <?php if ($read_more_url) { echo '<div class="mimic-smaller read-more uppercase"><a href="' . esc_url($read_more_url) . '">' . esc_html($read_more_text) . '</a></div>'; } echo '</div>'; echo ts_essentials_escape($args['after_widget']); }
function p2_get_discussion_links() { $comments = get_comments(array('post_id' => get_the_ID())); $unique_commentors = array(); foreach ($comments as $comment) { if ('1' == $comment->comment_approved) { $unique_commentors[$comment->comment_author_email] = get_avatar($comment, 16) . ' ' . get_comment_author_link($comment->comment_ID); } } $unique_commentors = array_values($unique_commentors); $total_unique_commentors = count($unique_commentors); $content = ''; if (1 == $total_unique_commentors) { $content = sprintf(__('%1$s is discussing.', 'p2'), $unique_commentors[0]); } else { if (2 == $total_unique_commentors) { $content = sprintf(__('%1$s and %2$s are discussing.', 'p2'), $unique_commentors[0], $unique_commentors[1]); } else { if (3 == $total_unique_commentors) { $content = sprintf(__('%1$s, %2$s, and %3$s are discussing.', 'p2'), $unique_commentors[0], $unique_commentors[1], $unique_commentors[2]); } else { if (3 < $total_unique_commentors) { $others = $total_unique_commentors - 3; $content .= sprintf(_n('%1$s, %2$s, %3$s, and %4$d other are discussing.', '%1$s, %2$s, %3$s, and %4$d others are discussing.', $others, 'p2'), $unique_commentors[0], $unique_commentors[1], $unique_commentors[2], $others); } } } } return $content; }
/** * Show user info on dashboard */ function user_info() { global $userdata; if (wpuf_get_option('show_user_bio', 'wpuf_dashboard', 'on') == 'on') { ?> <div class="wpuf-author"> <h3><?php _e('Author Info', 'wpuf'); ?> </h3> <div class="wpuf-author-inside odd"> <div class="wpuf-user-image"><?php echo get_avatar($userdata->user_email, 80); ?> </div> <div class="wpuf-author-body"> <p class="wpuf-user-name"><a href="<?php echo get_author_posts_url($userdata->ID); ?> "><?php printf(esc_attr__('%s', 'wpuf'), $userdata->display_name); ?> </a></p> <p class="wpuf-author-info"><?php echo $userdata->description; ?> </p> </div> </div> </div><!-- .author --> <?php } }
function widget($args, $instance) { extract($args); echo $before_widget; ?> <div class="zan-author text-center hidden-xs"> <div class="author-top"></div> <div class="author-bottom"> <?php echo get_avatar(get_the_author_meta('email'), '120'); ?> <div class="author-content"> <span class="author-name"><?php echo get_the_author_meta('display_name'); ?> </span> <span class="author-social"> <div class="btn-group btn-group-justified"> <a class="btn btn-zan-solid-wi" target="_blank" href="<?php echo get_the_author_meta('sina_weibo'); ?> "><i class="fa fa-weibo"></i> 新浪微博</a> <a class="btn btn-zan-solid-wi" target="_blank" href="<?php echo get_the_author_meta('tencent_weibo'); ?> "><i class="fa fa-tencent-weibo"></i> 腾讯微博</a> </div> </span> </div> </div> </div> <?php echo $after_widget; }
function readers_wall($outer = '1', $timer = '3', $limit = '100') { global $wpdb; $counts = $wpdb->get_results("SELECT count(comment_author) AS cnt, comment_author, comment_author_url, comment_author_email FROM {$wpdb->comments} WHERE comment_date > date_sub( now(), interval {$timer} month ) AND user_id!='1' AND comment_author!={$outer} AND comment_approved='1' AND comment_type='' GROUP BY comment_author ORDER BY cnt DESC LIMIT {$limit}"); $i = 0; foreach ($counts as $count) { $i++; $c_url = $count->comment_author_url; if (!$c_url) { $c_url = 'javascript:;'; } $tt = $i; if ($i == 1) { $tt = '金牌读者'; } else { if ($i == 2) { $tt = '银牌读者'; } else { if ($i == 3) { $tt = '铜牌读者'; } else { $tt = '第' . $i . '名'; } } } if ($i < 4) { $type .= '<a class="item-top item-' . $i . '" target="_blank" href="' . $c_url . '"><h4>【' . $tt . '】<small>评论:' . $count->cnt . '</small></h4>' . str_replace(' src=', ' data-src=', get_avatar($count->comment_author_email, $size = '36', AVATAR_DEFAULT)) . '<strong>' . $count->comment_author . '</strong>' . $c_url . '</a>'; } else { $type .= '<a target="_blank" href="' . $c_url . '" title="【' . $tt . '】评论:' . $count->cnt . '">' . str_replace(' src=', ' data-src=', get_avatar($count->comment_author_email, $size = '36', AVATAR_DEFAULT)) . $count->comment_author . '</a>'; } } echo $type; }
function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?> "> <div id="comment-<?php comment_ID(); ?> " class="comment-inner"> <figure class="vcard"> <?php echo get_avatar($comment, 70); ?> </figure> <div class="comment-container"> <div class="commentmeta"> <strong><?php comment_author_link(); ?> </strong> <span class="authorname"> <?php comment_date('M d, Y'); ?> - <?php comment_time('h:i A'); ?> <?php edit_comment_link("Edit", ''); ?> </span> </div> <div class="comment-text"> <?php if ($comment->comment_approved == '0') { ?> <em class="awaiting_moderation"><?php _e('Your comment is awaiting moderation.', THB_THEME_NAME); ?> </em> <?php } ?> <?php comment_text(); ?> <?php comment_reply_link(array_merge($args, array('reply_text' => __('Reply', THB_THEME_NAME), 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> </div> </div> <?php }
/** * Echo the widget content. * * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget */ function widget($args, $instance) { extract($args); //* Merge with defaults $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } $text = ''; if (!empty($instance['alignment'])) { $text .= '<span class="align' . esc_attr($instance['alignment']) . '">'; } $text .= get_avatar($instance['user'], $instance['size']); if (!empty($instance['alignment'])) { $text .= '</span>'; } if ('text' === $instance['author_info']) { $text .= $instance['bio_text']; } else { $text .= get_the_author_meta('description', $instance['user']); } $text .= $instance['page'] ? sprintf(' <a class="pagelink" href="%s">%s</a>', get_page_link($instance['page']), $instance['page_link_text']) : ''; //* Echo $text echo wpautop($text); //* If posts link option checked, add posts link to output if ($instance['posts_link']) { printf('<div class="posts_link posts-link"><a href="%s">%s</a></div>', get_author_posts_url($instance['user']), __('View My Blog Posts', 'genesis')); } echo $after_widget; }
/** * Prints HTML with meta information for the current post-date/time and author. */ function popperscores_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('published %s', 'post date', 'popperscores'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>'); $byline = sprintf(esc_html_x('by %s', 'post author', 'popperscores'), '<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>'); // Display the author avatar if the author has a Gravatar $author_id = get_the_author_meta('ID'); if (popperscores_validate_gravatar($author_id)) { echo '<div class="meta-content has-avatar">'; echo '<div class="author-avatar">' . get_avatar($author_id) . '</div>'; } else { echo '<div class="meta-content">'; } echo '<span class="byline"> ' . $byline . '</span><span class="posted-on">' . $posted_on . '</span>'; // WPCS: XSS OK. if (!post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(esc_html__('Leave a comment', 'popperscores'), esc_html__('1 Comment', 'popperscores'), esc_html__('% Comments', 'popperscores')); echo '</span>'; } echo '</div><!-- .meta-content -->'; }
function column_default($item, $column_name) { switch ($column_name) { case 'author': $user_info = get_userdata($item->post_author); if (!$user_info) { echo '<strong>Anonymous</strong>'; } else { echo '<strong>' . get_avatar($item->post_author, $size = '32') . ' ' . $user_info->display_name . '</strong>'; } break; case 'detail': global $post; setup_postdata($item); ?> <div class="submitted-on"><?php _e('Answered on ', 'dwqa'); ?> <a href="<?php echo get_permalink($item->ID); ?> "><?php echo $item->post_date; ?> </a></div> <?php the_excerpt(); ?> <?php break; default: return print_r($item, true); } }
function render($args, $instance) { global $gantry, $comments, $comment; ob_start(); $menu_class = $instance['menu_class']; $link_class = $instance['link_class']; if ($menu_class != '') { $menu_class = ' class="' . $menu_class . '"'; } else { $menu_class = ''; } if ($link_class != '') { $link_class = ' class="' . $link_class . '"'; } else { $link_class = ''; } $cache = wp_cache_get('gantry_recentcomments', 'widget'); if (!is_array($cache)) { $cache = array(); } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } $output = ''; if (!($number = (int) $instance['number'])) { $number = 5; } else { if ($number < 1) { $number = 1; } } if (!($word_limit = (int) $instance['word_limit'])) { $word_limit = 8; } else { if ($word_limit < 1) { $word_limit = 1; } } $comments = get_comments(array('number' => $number, 'status' => 'approve')); $output .= '<ul' . $menu_class . '>'; if ($comments) { foreach ((array) $comments as $comment) { $words = explode(' ', strip_tags($comment->comment_content)); $comment_text = implode(' ', array_slice($words, 0, $word_limit)); $avatar = get_avatar($comment->comment_author_email, $size = 32); $avatar = str_replace("class='", "class='rt-image ", $avatar); $output .= '<li class="gantry_recentcomments">'; $output .= $avatar; $output .= '<a href="' . get_comment_link($comment->comment_ID) . '"' . $link_class . '>' . $comment_text . '...</a>'; $output .= '<br />By ' . $comment->comment_author; $output .= '</li>'; } } $output .= '</ul>'; echo $output; $cache[$args['widget_id']] = $output; wp_cache_set('gantry_recentcomments', $cache, 'widget'); echo ob_get_clean(); }
public function userinfo() { $mess = array(); $mess['uid'] = intval(session("u_id")); $vo = M('members')->field('id,user_name,user_email,user_pass,is_ban')->where("id={$mess['uid']}")->find(); $mess['username'] = $vo['user_name']; $mess['phone'] = intval(session("u_user_phone")); $mess['head'] = get_avatar($mess['uid']); //头像 $minfo = getMinfo($mess['uid'], true); $mess['credits'] = getLeveIco($minfo['credits'], 3); //会员等级 $membermoney = M("member_money")->field(true)->where("uid={$mess['uid']}")->find(); if (is_array($membermoney)) { $mess['mayuse'] = $membermoney['account_money'] + $membermoney['back_money']; //可用 $mess['freeze'] = $membermoney['money_freeze']; //冻结 $mess['collect'] = $membermoney['money_collect']; //代收 $mess['total'] = $mess['mayuse'] + $mess['freeze'] + $mess['collect']; //总额 } else { $mess['total'] = 0; $mess['mayuse'] = 0; $mess['freeze'] = 0; $mess['collect'] = 0; } ajaxmsg($mess); }
function secret_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li class="list-group-item" id="li-comment-<?php comment_ID(); ?> "> <div class="media container"> <div class="media-left"> <?php if (function_exists('get_avatar') && get_option('show_avatars')) { echo get_avatar($comment, 48); } ?> </div> <div class="media-body"> <div class="row" id="comment-<?php comment_ID(); ?> "> <div class="col-md-4"> <?php printf(__('<cite class="author_name">%s</cite>'), get_comment_author_link()); ?> <?php edit_comment_link('修改'); ?> </div> <div class="col-md-4"> 发表于:<?php echo get_comment_time('Y-m-d H:i'); ?> </div> </div> <div class="row"> <div class="col-md-8"> <?php if ($comment->comment_approved == '0') { ?> <em>你的评论正在审核,稍后会显示出来!</em><br /> <?php } ?> <?php comment_text(); ?> </div> </div> </div> <div class="row"> <?php comment_reply_link(array_merge($args, array('reply_text' => '回复', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> </div> <?php }
function sf_custom_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; ?> <li id="comment-<?php comment_ID(); ?> " <?php comment_class('clearfix'); ?> > <div class="comment-wrap clearfix"> <div class="comment-avatar"> <?php if (function_exists('get_avatar')) { echo get_avatar($comment, '100'); } ?> <?php if ($comment->comment_author_email == get_the_author_meta('email')) { ?> <span class="tooltip"><?php _e("Author", "swiftframework"); ?> <span class="arrow"></span></span> <?php } ?> </div> <div class="comment-content"> <div class="comment-meta"> <?php printf('<span class="comment-author">%1$s</span> <span class="comment-date">%2$s</span>', get_comment_author_link(), human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . __("ago", "swiftframework")); ?> <div class="comment-meta-actions"> <?php edit_comment_link(__('Edit', 'swiftframework'), '<span class="edit-link">', '</span><span class="meta-sep"> |</span>'); ?> <?php if ($args['type'] == 'all' || get_comment_type() == 'comment') { comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'swiftframework'), 'login_text' => __('Log in to reply.', 'swiftframework'), 'depth' => $depth, 'before' => '<span class="comment-reply">', 'after' => '</span>'))); } ?> </div> </div> <?php if ($comment->comment_approved == '0') { _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'swiftframework'); } ?> <div class="comment-body"> <?php comment_text(); ?> </div> </div> </div> <?php }
function webnus_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?> "> <div class="comment-info"> <?php echo get_avatar($comment, 90); ?> <cite> <?php comment_author_link(); ?> <?php _e('Says', 'WEBNUS_TEXT_DOMAIN'); ?> : <span class="comment-data"><a href="#comment-<?php comment_ID(); ?> " title=""><?php comment_date('F j, Y'); ?> at <?php comment_time('g:i a'); ?> </a><?php edit_comment_link('Edit', ' | ', ''); ?> </span> </cite> </div> <div class="comment-text"> <?php if ($comment->comment_approved == '0') { ?> <p><em><?php _e('Your comment is awaiting moderation.', 'WEBNUS_TEXT_DOMAIN'); ?> </em></p> <?php } ?> <?php comment_text(); ?> <div class="reply"> <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </div> </div> <?php }
function list_cp_users() { global $wpdb; $cp_proj_table_name = $wpdb->prefix . "cp_projects"; $cp_tasks_table_name = $wpdb->prefix . "cp_tasks"; $cp_list_users = $wpdb->get_results("SELECT auth FROM {$cp_proj_table_name} UNION SELECT users FROM {$cp_tasks_table_name}"); if ($cp_list_users) { foreach ($cp_list_users as $cp_list_user) { $user_info = get_userdata($cp_list_user->auth); echo '<div id="cp-gravatar" style="height:62px;width:62px;background:#F0F0F0;">'; // Default gravatar $def_gravatar = "http://www.gravatar.com/avatar/c11f04eee71dfd0f49132786c34ea4ff?s=50&d=&r=G&forcedefault=1"; // User link echo '<a href="admin.php?page=cp-dashboard-page&view=userpage&user='******'">'; // Get gravatar echo get_avatar($user_info->user_email, $size = '50', $default = $def_gravatar); echo '</a>'; echo '</div>'; echo '<div id="cp-task-summary">'; // User link echo '<a href="admin.php?page=cp-dashboard-page&view=userpage&user='******'">'; // Display username echo '<p><strong>' . $user_info->user_nicename . '</strong></p>'; echo '</a>'; echo '</div>'; } } else { // There are no users yet echo "<p>No users...</p>"; } }
function hwseo_jsonld_person() { $payload = array('@type' => 'Person'); if (is_author()) { global $wp_query; $author_data = $wp_query->get_queried_object(); } elseif (is_single()) { global $post; $author_data = get_userdata($post->post_author); } else { $author_data = get_userdata(1); } //refer to admin // fetch twitter from author meta and concatenate with full twitter URL $twitter_url = " https://twitter.com/"; $twitterHandle = get_the_author_meta('twitter', $author_data->ID); $twitterHandleURL = $twitter_url . $twitterHandle; $websiteHandle = get_the_author_meta('url', $author_data->ID); $facebookHandle = get_the_author_meta('facebook', $author_data->ID); $gplusHandle = get_the_author_meta('googleplus', $author_data->ID); $linkedinHandle = get_the_author_meta('linkedin', $author_data->ID); $slideshareHandle = get_the_author_meta('slideshare', $author_data->ID); //user custom fields $phone = get_the_author_meta('phone', $author_data->ID); $jobtitle = get_the_author_meta('jobtitle', $author_data->ID); $payload['name'] = $author_data->display_name; $payload['email'] = $author_data->user_email; $payload['telephone'] = $phone; $payload['image'] = get_avatar_url(get_avatar($author_data->ID, 150)); $payload['jobTitle'] = $jobtitle; $payload["sameAs"] = array($twitterHandleURL, $websiteHandle, $facebookHandle, $gplusHandle, $linkedinHandle, $slideshareHandle); return $payload; }