本文整理汇总了PHP中get_the_author_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_author_link函数的具体用法?PHP get_the_author_link怎么用?PHP get_the_author_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_author_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
extract($args);
global $wp_query;
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$number = $instance['number'];
$category = $instance['category'];
/* Before widget (defined by themes). */
echo $before_widget;
/* Display the widget title if one was input (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
if (!$number) {
$number = -1;
}
$blog_posts = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number, 'category__in' => $category, 'orderby' => 'comment_count', 'order' => 'DESC', 'ignore_sticky_posts' => true));
if ($blog_posts->have_posts()) {
?>
<ul class="most-liked-list most-commented">
<?php
while ($blog_posts->have_posts()) {
$blog_posts->the_post();
$comments_count = wp_count_comments(get_the_ID());
$comments_approved = $comments_count->approved;
$post_author = get_the_author_link();
$post_date = get_the_date();
?>
<li>
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
<span><?php
printf(__('By %1$s on %2$s', 'hbthemes'), $post_author, $post_date);
?>
</span>
<span class="like-count"><i class="hb-moon-bubbles-7"></i></span>
<a href="<?php
the_permalink();
?>
" class="like-count-num"><?php
echo number_format($comments_approved);
?>
</a>
</li>
<?php
}
?>
</ul>
<?php
}
echo $after_widget;
}
示例2: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$instance = wp_parse_args($instance, array('title' => __('Latest Questions', 'dwqa'), 'number' => 5));
echo $before_widget;
echo $before_title;
echo $instance['title'];
echo $after_title;
$args = array('posts_per_page' => $instance['number'], 'order' => 'DESC', 'orderby' => 'post_date', 'post_type' => 'dwqa-question', 'suppress_filters' => false);
$questions = new WP_Query($args);
if ($questions->have_posts()) {
echo '<div class="dwqa-popular-questions">';
echo '<ul>';
while ($questions->have_posts()) {
$questions->the_post();
echo '
<li><a href="' . get_permalink() . '" class="question-title">' . get_the_title() . '</a> ' . __('asked by', 'dwqa') . ' ' . (dwqa_is_anonymous(get_the_ID()) ? __('Anonymous', 'dwqa') : get_the_author_link()) . ', ' . human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
'</li>';
}
echo '</ul>';
echo '</div>';
}
wp_reset_query();
wp_reset_postdata();
echo $after_widget;
}
示例3: shortcode_popular_questions
public function shortcode_popular_questions($atts)
{
extract(shortcode_atts(array('number' => 5, 'title' => __('Popular Questions', 'dwqa')), $atts));
$args = array('posts_per_page' => $number, 'order' => 'DESC', 'orderby' => 'meta_value_num', 'meta_key' => '_dwqa_views', 'post_type' => 'dwqa-question', 'suppress_filters' => false);
$questions = new WP_Query($args);
$html = '';
if ($title) {
$html .= '<h3>';
$html .= $title;
$html .= '</h3>';
}
if ($questions->have_posts()) {
$html .= '<div class="dwqa-popular-questions">';
$html .= '<ul>';
while ($questions->have_posts()) {
$questions->the_post();
$html .= '<li><a href="' . get_permalink() . '" class="question-title">' . get_the_title() . '</a> ' . __('asked by', 'dwqa') . ' ' . get_the_author_link() . '</li>';
}
$html .= '</ul>';
$html .= '</div>';
}
wp_reset_query();
wp_reset_postdata();
return $html;
}
示例4: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$instance = wp_parse_args($instance, array('title' => __('Closed Questions', 'dwqa'), 'number' => 5));
echo $before_widget;
echo $before_title;
echo $instance['title'];
echo $after_title;
$args = array('post_type' => 'dwqa-question', 'meta_query' => array('relation' => 'OR', array('key' => '_dwqa_status', 'compare' => '=', 'value' => 'resolved'), array('key' => '_dwqa_status', 'compare' => '=', 'value' => 'closed')));
$questions = new WP_Query($args);
if ($questions->have_posts()) {
echo '<div class="dwqa-popular-questions">';
echo '<ul>';
while ($questions->have_posts()) {
$questions->the_post();
echo '
<li><a href="' . get_permalink() . '" class="question-title">' . get_the_title() . '</a> ' . __('asked by', 'dwqa') . ' ' . get_the_author_link();
'</li>';
}
echo '</ul>';
echo '</div>';
}
wp_reset_query();
wp_reset_postdata();
echo $after_widget;
}
示例5: appletree_post_meta
/**
* Displays meta information for a post
* @return void
*/
function appletree_post_meta()
{
if (get_post_type() == 'post') {
echo sprintf(__('Posted %s in %s%s by %s. ', 'appletreesg.com'), get_the_time(get_option('date_format')), get_the_category_list(', '), get_the_tag_list(__(', <b>Tags</b>: ', 'appletreesg.com'), ', '), get_the_author_link());
}
edit_post_link(__(' (edit)', 'appletreesg.com'), '<span class="edit-link">', '</span>');
}
示例6: theme_latest_news
function theme_latest_news($atts, $content)
{
global $themename;
extract(shortcode_atts(array("count" => 2, "category" => "", "order" => "DESC"), $atts));
query_posts(array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'cat' => $category, 'order' => $order));
$output = '<ul class="blog clearfix">';
if (have_posts()) {
while (have_posts()) {
the_post();
$post_classes = get_post_class("post");
$output .= '<li class="';
foreach ($post_classes as $key => $post_class) {
$output .= $post_class . ($key + 1 < count($post_classes) ? ' ' : '');
}
$output .= '">
<div class="comment_box">
<div class="first_row">
' . get_the_time("d") . '<span class="second_row">' . strtoupper(get_the_time("M")) . '</span>
</div>';
$comments_count = get_comments_number();
$output .= ' <a class="comments_number" href="' . get_comments_link() . '" title="' . $comments_count . ($comments_count == 1 ? ' ' . __('Comment', $themename) : ' ' . __('Comments', $themename)) . '">' . $comments_count . ($comments_count == 1 ? ' ' . __('Comment', $themename) : ' ' . __('Comments', $themename)) . '</a>
</div>
<div class="post_content">';
if (has_post_thumbnail()) {
$output .= '<a class="post_image" href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_post_thumbnail(get_the_ID(), "blog-post-thumb", array("alt" => get_the_title(), "title" => "")) . '</a>';
}
$output .= ' <h2>
<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a>
</h2>
<div class="text">
' . apply_filters('the_excerpt', get_the_excerpt()) . '
</div>
<div class="post_footer">
<ul class="categories">
<li class="posted_by">' . __('Posted by', $themename) . ' <a class="author" href="' . get_the_author_link() . '" title="' . get_the_author() . '">' . get_the_author() . '</a></li>';
$categories = get_the_category();
foreach ($categories as $key => $category) {
$output .= '<li>
<a href="' . get_category_link($category->term_id) . '" ';
if (empty($category->description)) {
$output .= 'title="' . sprintf(__('View all posts filed under %s', $themename), $category->name) . '"';
} else {
$output .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"';
}
$output .= '>' . $category->name . '</a>
</li>';
}
$output .= ' </ul>
<a class="more icon_small_arrow margin_right_white" href="' . get_permalink() . '" title="' . __("More", $themename) . '">' . __("More", $themename) . '</a>
</div>
</div>
</li>';
}
}
$output .= '</ul>';
//Reset Query
wp_reset_query();
return $output;
}
示例7: uppsite_get_member
function uppsite_get_member()
{
$avatar = null;
if (function_exists('get_the_author_meta')) {
$avatar = get_avatar(get_the_author_meta('user_email'));
} elseif (function_exists('get_the_author_id')) {
$avatar = get_avatar(get_the_author_id());
}
return array('name' => get_the_author(), 'link' => get_the_author_link(), 'avatar' => uppsite_extract_src_url($avatar));
}
示例8: hook_after_post_content
public function hook_after_post_content($content)
{
if (is_single()) {
$content .= '
<div class="focuswarp">
<div class="focusavatar">
' . get_avatar(get_the_author_email(), '80') . '
</div>
<div class="focustext">
<h4>Author: <span>' . get_the_author_link('display_name', get_query_var('author')) . '</span></h4>' . get_the_author_meta('description', get_query_var('author')) . '
</div>';
$content .= '
<div class="focus-social">
';
if (get_the_author_meta('twitter', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('twitter')) . '" target="_blank"><i class="fa fa-twitter fa-lg"></i> Twitter</a> ';
}
if (get_the_author_meta('facebook', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('facebook')) . '" target="_blank"><i class="fa fa-facebook fa-lg"></i> Facebook</a> ';
}
if (get_the_author_meta('gplus', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('gplus')) . '" target="_blank"><i class="fa fa-google-plus fa-lg"></i> Google+</a> ';
}
if (get_the_author_meta('linkedin', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('linkedin')) . '" target="_blank"><i class="fa fa-linkedin fa-lg"></i> Linkedin</a> ';
}
if (get_the_author_meta('dribbble', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('dribbble')) . '" target="_blank"><i class="fa fa-dribbble fa-lg"></i> Dribbble</a> ';
}
if (get_the_author_meta('github', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('github')) . '" target="_blank"><i class="fa fa-github fa-lg"></i> Github</a>';
}
if (get_the_author_meta('youtube', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('youtube')) . '" target="_blank"><i class="fa fa-youtube fa-lg"></i> Youtube</a>';
}
if (get_the_author_meta('pinterest', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('pinterest')) . '" target="_blank"><i class="fa fa-pinterest-square fa-lg"></i> Pinterest</a>';
}
if (get_the_author_meta('instagram', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('instagram')) . '" target="_blank"><i class="fa fa-instagram fa-lg"></i> Instagram</a>';
}
if (get_the_author_meta('vimeo', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('vimeo')) . '" target="_blank"><i class="fa fa-vimeo-square fa-lg"></i> vimeo</a>';
}
if (get_the_author_meta('skype', get_query_var('author'))) {
$content .= '<a href="' . esc_url(get_the_author_meta('skype')) . '" target="_blank"><i class="fa fa-skype fa-lg"></i> Skype</a>';
}
$content .= '
</div>
</div>';
}
return $content;
}
示例9: createPageObject
public static function createPageObject($getComments = false, $postObject = null)
{
global $post;
if ($postObject != null) {
setup_postdata($postObject);
}
$params = array('pageLink' => get_page_link(), 'post_title' => get_the_title(), 'time' => get_the_time(), 'post_content' => apply_filters('the_content', get_the_content()), 'post_excerpt' => get_the_excerpt(), 'post_author' => get_the_author(), 'author_link' => get_the_author_link(), 'thumbnails' => self::getThumbnails($post), 'pageUri' => get_page_uri($post), 'comments' => '');
if ($getComments != false) {
$params['comments'] = self::getComments($post->ID);
}
$post_object_var = get_object_vars($post);
$post_params = $params + $post_object_var;
return new Page($post_params);
}
示例10: lady_B_post_header
/**
* Prints HTML with header, title and meta information for the current post.
*
*/
function lady_B_post_header($showDate = true)
{
$mh2 = sprintf('<h2><a href="%s">%s</a></h2>', esc_url(get_the_permalink()), esc_attr(get_the_title()));
$mauthor = sprintf('<span class="posted">By %s</span>', get_the_author_link());
$mdate = "";
if ($showDate) {
$mdate = sprintf('<span class="date"><a href="%s">%s</a></span>', esc_url(get_the_permalink()), esc_html(get_the_time("F jS, Y")));
}
$postClass = get_post_class();
$mClass = "";
foreach ($postClass as $class) {
$mClass .= $class . " ";
}
print "<article> <!--new post --><header class='" . $mClass . "'>" . $mh2 . "<p>" . $mauthor . $mdate . "</p></header><div class='entry'>";
}
示例11: createPostObject
public static function createPostObject($getComments = false, $postObject = null)
{
global $post;
if ($postObject != null) {
setup_postdata($postObject);
}
$tags = get_the_tags();
$categories = get_the_category();
$params = array('permalink' => get_permalink(), 'post_title' => get_the_title(), 'time' => get_the_time(), 'post_content' => self::getTheContent(), 'post_excerpt' => get_the_excerpt(), 'post_author' => get_the_author(), 'author_link' => get_the_author_link(), 'tags' => self::getTags($tags), 'categories' => self::getCategories($categories), 'thumbnails' => self::getThumbnails($post), 'comments' => '');
if ($getComments != false) {
$params['comments'] = self::getComments($post->ID);
}
$post_object_var = get_object_vars($post);
$post_params = $params + $post_object_var;
//echo '<pre>';
//print_r($post_params);
//echo '</pre>';
//exit();
return new Post($post_params);
}
示例12: blog_shortcode
function blog_shortcode($atts, $content = null, $code)
{
global $wp_filter;
$the_content_filter_backup = $wp_filter['the_content'];
extract(shortcode_atts(array('max' => 3, 'meta' => ''), $atts));
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$query = array('post_type' => 'post', 'posts_per_page' => $max, 'paged' => $paged);
query_posts($query);
while (have_posts()) {
the_post();
$output .= '<div class="blog_post">';
$output .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
if ($meta == "true") {
$output .= '<div class="metaInfo">Posted By ';
$output .= get_the_author_link();
$output .= ' / ';
$output .= get_the_time('F, j, Y');
$output .= ' / <a href="';
$output .= get_comments_link();
$output .= '">';
$output .= get_comments_number('0', '1', '%');
$output .= ' comments</a></div>';
}
if (has_post_thumbnail()) {
$output .= '<div class="portfolio_thumbnail">';
$thumb = get_post_thumbnail_id();
$image = vt_resize($thumb, '', 530, 280, true, 70);
$output .= '<a href="' . get_permalink() . '"><img src="' . $image[url] . '" width="' . $image[width] . '" height="' . $image[height] . '" alt="' . $lbtitle . '" /></a>';
$output .= '</div>';
}
$output .= apply_filters('the_content', get_the_content());
$output .= '</div>';
}
ob_start();
wp_pagenavi();
$output .= ob_get_clean();
wp_reset_query();
$wp_filter['the_content'] = $the_content_filter_backup;
return $output;
}
示例13: getPost
private static function getPost($dateFormat = false, $customFields = array())
{
if (!$dateFormat) {
$dateFormat = get_option('date_format');
}
$tags = get_the_tags();
$categories = get_the_category();
$post = array('permalink' => get_permalink(), 'title' => get_the_title(), 'time' => get_the_time($dateFormat), 'content' => self::getTheFilteredContentFromLoop(), 'excerpt' => get_the_excerpt(), 'author' => get_the_author(), 'author_link' => get_the_author_link(), 'the_tags' => self::getTagsAsArray($tags), 'the_categories' => self::getCategoriesAsArray($categories));
if (!$tags) {
$post['has_tags'] = false;
} else {
$post['has_tags'] = true;
}
if (!$categories) {
$post['has_categories'] = false;
} else {
$post['has_categories'] = true;
}
$post = self::addCustomFieldsToPost($customFields, $post);
$post = self::addThumbnailsToPost($post);
return $post;
}
示例14: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$instance = wp_parse_args($instance, array('title' => __('Popular Questions', 'dwqa'), 'number' => 5));
echo $before_widget;
echo $before_title;
echo $instance['title'];
echo $after_title;
$args = array('posts_per_page' => $instance['number'], 'order' => 'DESC', 'orderby' => 'meta_value_num', 'meta_key' => '_dwqa_views', 'post_type' => 'dwqa-question', 'suppress_filters' => false);
$questions = new WP_Query($args);
if ($questions->have_posts()) {
echo '<div class="dwqa-popular-questions">';
echo '<ul>';
while ($questions->have_posts()) {
$questions->the_post();
echo '<li><a href="' . get_permalink() . '" class="question-title">' . get_the_title() . '</a> ' . __('asked by', 'dwqa') . ' ' . get_the_author_link() . '</li>';
}
echo '</ul>';
echo '</div>';
}
wp_reset_query();
wp_reset_postdata();
echo $after_widget;
}
示例15: content
protected function content($atts, $content = null)
{
$options = get_option('sf_dante_options');
$title = $category = $item_class = $excerpt_length = $width = $offset = $el_class = $output = $filter = $items = $el_position = $item_count = '';
extract(shortcode_atts(array('title' => '', 'show_title' => 'yes', 'show_excerpt' => 'yes', "excerpt_length" => '20', "item_count" => '12', "show_details" => 'yes', "offset" => '0', "posts_order" => 'ASC', "category" => 'all', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
// CATEGORY SLUG MODIFICATION
if ($category == "All") {
$category = "all";
}
if ($category == "all") {
$category = '';
}
$category_slug = str_replace('_', '-', $category);
global $post, $wp_query, $sf_carouselID;
if ($sf_carouselID == "") {
$sf_carouselID = 1;
} else {
$sf_carouselID++;
}
$blog_args = array('post_type' => 'post', 'post_status' => 'publish', 'no_found_rows' => 1, 'category_name' => $category_slug, 'posts_per_page' => $item_count, 'offset' => $offset, 'order' => $posts_order);
$blog_items = new WP_Query($blog_args);
$count = $columns = 0;
$sidebar_config = sf_get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
if (is_singular('portfolio')) {
$sidebar_config = "no-sidebars";
}
if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
$item_class = 'span2';
} else {
if ($sidebar_config == "both-sidebars") {
$item_class = 'span-bs-quarter';
} else {
$item_class = 'span3';
}
}
if ($width == "1/4") {
$columns = 1;
} else {
if ($width == "1/2") {
$columns = 2;
} else {
if ($width == "3/4") {
$columns = 3;
} else {
$columns = 4;
}
}
}
$items .= '<div class="carousel-wrap">';
$items .= '<div id="carousel-' . $sf_carouselID . '" class="blog-items carousel-items clearfix" data-columns="' . $columns . '">';
while ($blog_items->have_posts()) {
$blog_items->the_post();
$item_title = get_the_title();
$post_author = get_the_author_link();
$post_date = get_the_date();
$post_comments = get_comments_number();
$post_category = get_the_category();
$thumb_type = sf_get_post_meta($post->ID, 'sf_thumbnail_type', true);
$thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full');
$thumb_video = sf_get_post_meta($post->ID, 'sf_thumbnail_video_url', true);
$thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image');
$thumb_link_type = sf_get_post_meta($post->ID, 'sf_thumbnail_link_type', true);
$thumb_link_url = sf_get_post_meta($post->ID, 'sf_thumbnail_link_url', true);
$thumb_lightbox_thumb = rwmb_meta('sf_thumbnail_image', 'type=image&size=large');
$thumb_lightbox_image = rwmb_meta('sf_thumbnail_link_image', 'type=image&size=large');
$thumb_lightbox_video_url = sf_get_post_meta($post->ID, 'sf_thumbnail_link_video_url', true);
$thumb_lightbox_video_url = sf_get_embed_src($thumb_lightbox_video_url);
foreach ($thumb_image as $detail_image) {
$thumb_img_url = $detail_image['url'];
break;
}
if (!$thumb_image) {
$thumb_image = get_post_thumbnail_id();
$thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
}
$thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
$item_title = get_the_title();
$post_permalink = get_permalink();
$custom_excerpt = sf_get_post_meta($post->ID, 'sf_custom_excerpt', true);
$post_excerpt = '';
if ($custom_excerpt != '') {
$post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length);
} else {
$post_excerpt = sf_excerpt($excerpt_length);
}
if ($thumb_link_type == "link_to_url") {
$link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
$item_icon = "ss-link";
} else {
if ($thumb_link_type == "link_to_url_nw") {
$link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"';
$item_icon = "ss-link";
} else {
if ($thumb_link_type == "lightbox_thumb") {
$link_config = 'href="' . $thumb_img_url . '" class="lightbox" data-rel="ilightbox[' . $post_ID . ']"';
$item_icon = "ss-view";
} else {
if ($thumb_link_type == "lightbox_image") {
$lightbox_image_url = '';
foreach ($thumb_lightbox_image as $image) {
//.........这里部分代码省略.........