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


PHP get_comments_link函数代码示例

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


在下文中一共展示了get_comments_link函数的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.
 }
开发者ID:jgcopple,项目名称:drgaryschwantz,代码行数:29,代码来源:template-tags.php

示例2: widget

 function widget($args, $instance)
 {
     global $post;
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $title = !empty($instance['title']) ? $instance['title'] : '';
     if (!is_single()) {
         return;
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title;
         echo $title;
         echo $after_title;
     }
     $name = get_the_author_meta('display_name', $post->post_author);
     echo '<div class="large-icons">';
     echo '<ul>';
     edit_post_link('<i class="icon-pencil"></i>' . __('Edit', 'myThemes'), '<li>', '</li>');
     echo '<li><a href="' . get_day_link(get_post_time('Y', false, $post->ID), get_post_time('m', false, $post->ID), get_post_time('d', false, $post->ID)) . '">';
     echo '<time datetime="' . get_post_time('Y-m-d', false, $post->ID) . '"><i class="icon-calendar"></i>' . get_post_time(get_option('date_format'), false, $post->ID) . '</time></a></li>';
     echo '<li><a href="' . get_author_posts_url($post->post_author) . '" title="' . __('Writed by ', 'myThemes') . ' ' . $name . '"><i class="icon-user-5"></i>' . $name . '</a></li>';
     if ($post->comment_status == 'open') {
         $nr = get_comments_number($post->ID);
         if ($nr == 1) {
             $comments = $nr . ' ' . __('Comment', 'myThemes');
         } else {
             $comments = $nr . ' ' . __('Comments', 'myThemes');
         }
         echo '<li><a href="' . get_comments_link($post->ID) . '"><i class="icon-comment"></i>' . $comments . '</a></li>';
     }
     echo '</ul>';
     echo '</div>';
     echo $after_widget;
 }
开发者ID:mathieu-aubin,项目名称:verbo-linuq,代码行数:35,代码来源:my_wdg_meta.php

示例3: wheels_entry_meta

 /**
  * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
  *
  * @return void
  */
 function wheels_entry_meta()
 {
     if (is_sticky() && is_home() && !is_paged()) {
         echo '<span class="featured-post">' . __('Sticky', 'wheels') . '</span>';
     }
     if (!has_post_format('link') && 'post' == get_post_type()) {
         wheels_entry_date();
     }
     // Translators: used between list items, there is a space after the comma.
     $categories_list = get_the_category_list(__(', ', 'wheels'));
     if ($categories_list) {
         echo '/<span class="categories-links">' . $categories_list . '</span>';
     }
     // Translators: used between list items, there is a space after the comma.
     $tag_list = get_the_tag_list('', __(', ', 'wheels'));
     if ($tag_list) {
         echo '/<span class="tags-links">' . $tag_list . '</span>';
     }
     // Post author
     if ('post' == get_post_type()) {
         printf('/<span class="author vcard">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author">%4$s</a></span>', __('by', 'wheels'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'wheels'), get_the_author())), get_the_author());
         $num_comments = get_comments_number();
         // get_comments_number returns only a numeric value
         if ($num_comments == 0) {
         } else {
             if ($num_comments > 1) {
                 $comments = $num_comments . __(' Comments', 'wheels');
             } else {
                 $comments = __('1 Comment', 'wheels');
             }
             echo $write_comments = '/<span class="comments-count"><a href="' . get_comments_link() . '">' . $comments . '</a></span>';
         }
     }
 }
开发者ID:selinaross,项目名称:spring-ridge,代码行数:39,代码来源:extras.php

示例4: ts_recentposts

function ts_recentposts($atts, $content = null)
{
    extract(shortcode_atts(array("title" => '', "cat" => '', "longchar" => 130), $atts));
    $content = ts_remove_autop($content);
    $output = '';
    if ($title != "") {
        $output .= '<h2 class="title_pattern uppercase"><span>' . $title . '</span></h2>';
    }
    $i = 1;
    query_posts("showposts=4&category_name=" . $cat);
    global $post;
    $output .= '<ul id="recentpost">';
    while (have_posts()) {
        the_post();
        if ($i % 4 == 0) {
            $addclass = "last";
        } else {
            $addclass = "";
        }
        $excerpt = get_the_excerpt();
        //get_comment
        $num_comments = get_comments_number();
        // for some reason get_comments_number only returns a numeric value displaying the number of comments
        if (comments_open()) {
            if ($num_comments == 0) {
                $comments = __('No Comments', 'templatesquare');
            } elseif ($num_comments > 1) {
                $comments = $num_comments . __(' Comments', 'templatesquare');
            } else {
                $comments = "1 Comment";
            }
            $write_comments = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
        } else {
            $write_comments = __('Comments off', 'templatesquare');
        }
        //get blog post thumb
        $custom = get_post_custom($post->ID);
        $cf_thumb = isset($custom["thumb"][0]) ? $custom["thumb"][0] : "";
        if ($cf_thumb != "") {
            $thumb = '<img src=' . $cf_thumb . ' alt="" width="210" height="158" class="frame"/><span class="shadowimg220"></span>';
        } elseif (has_post_thumbnail($post->ID)) {
            $thumb = get_the_post_thumbnail($post->ID, 'blog-post-thumb', array('alt' => '', 'class' => 'frame')) . '<span class="shadowimg220"></span>';
        } else {
            $thumb = "";
        }
        $output .= '<li class="' . $addclass . '">';
        $output .= $thumb;
        $output .= '<div class="entry-date">' . get_the_time('d/m/y') . ' - ' . $write_comments . '</div>';
        $output .= '<h5 class="colortext"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>';
        $output .= '<span>' . ts_string_limit_char($excerpt, $longchar) . '</span>';
        $output .= '</li>';
        $i++;
        $addclass = "";
    }
    wp_reset_query();
    $output .= '</ul>';
    $output .= '<div class="clear"></div>';
    return do_shortcode($output);
}
开发者ID:uoyknaht,项目名称:kc,代码行数:59,代码来源:recent-posts.php

示例5: 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;
}
开发者ID:DarussalamTech,项目名称:aims_prj,代码行数:59,代码来源:latest_news.php

示例6: gently_comments_count

 /**
  * Returns HTML with comments count if there are any.
  *
  * @return string Comments count.
  */
 function gently_comments_count()
 {
     /* Display comments count only if the are available. */
     if (!post_password_required() && (comments_open() || get_comments_number())) {
         return sprintf('<a class="comments-count" href="' . get_comments_link() . '"><span class="screen-reader-text">%s</span><i class="fa fa-comments" aria-hidden="true"></i>&nbsp;' . get_comments_number() . '</a>', esc_html__('Comments count', 'gently'));
     }
     return '';
 }
开发者ID:Greg36,项目名称:Gently,代码行数:13,代码来源:template-tags.php

示例7: widget

 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $categories = empty($instance['categories']) ? $instance['categories'] : implode($instance['categories'], ',');
     $count = empty($instance['count']) ? 5 : $instance['count'];
     $limit = empty($instance['limit']) ? 100 : $instance['limit'];
     $show_thumbnails = $instance['show_thumbnails'];
     $show_excerpt = $instance['show_excerpt'];
     $all_post_formats = $instance['all_post_formats'];
     $thumb_width = empty($instance['thumb_width']) ? 50 : $instance['thumb_width'];
     $thumb_height = empty($instance['thumb_height']) ? 50 : $instance['thumb_height'];
     //remove aside and quote post formats from the list
     $postargs = $all_post_formats ? array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1) : array('orderby' => 'comment_count', 'tax_query' => array(array('operator' => 'NOT IN', 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote', 'post-format-aside'))), 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
     $post_query = new WP_Query($postargs);
     $rt_posts = '<div class="recent_posts clearfix"><ul>';
     if ($post_query->have_posts()) {
         while ($post_query->have_posts()) {
             $post_query->the_post();
             $post_title = get_the_title();
             $link = get_permalink();
             $date = get_the_time('d M Y');
             $comment_count = get_comment_count($post_query->post->ID);
             $rt_gallery_images = get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_images", true) ? get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_images", true) : "";
             $rt_gallery_image_titles = get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_titles", true) ? get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_titles", true) : "";
             $rt_gallery_image_descs = get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_descs", true) ? get_post_meta($post_query->post->ID, THEMESLUG . "rt_gallery_image_descs", true) : "";
             $fist_featured_image = is_array($rt_gallery_images) ? find_image_org_path($rt_gallery_images[0]) : "";
             $rt_posts .= '<li class="clearfix">';
             if ($fist_featured_image && !$show_thumbnails) {
                 $f_image = @vt_resize('', $fist_featured_image, $thumb_width, $thumb_height, true);
                 if ($f_image["url"]) {
                     $rt_posts .= '<img src="' . $f_image["url"] . '" alt="' . $title . '" class="recent-posts-thumb" />';
                 }
             }
             $rt_posts .= '<span class="date">' . $date . '</span>';
             $rt_posts .= '<span class="title"><a href="' . $link . '">' . $post_title . '</a></span>';
             $rt_posts .= $show_excerpt ? '' . wp_html_excerpt(get_the_excerpt(), $limit) . '...' : "";
             if ($comment_count['approved'] > 0) {
                 if ($comment_count['approved'] > 1) {
                     $comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
                 } else {
                     $comments = __('1 Comment', 'rt_theme');
                 }
                 $rt_posts .= ' <span class="comment_number date"><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comments . '</a></span>';
                 $rt_posts .= $show_excerpt ? '<div class="space margin-b10"></div>' : "";
             }
             $rt_posts .= '</li>';
         }
     }
     wp_reset_query();
     $rt_posts .= '</ul></div>';
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo $rt_posts;
     echo $after_widget;
 }
开发者ID:patrickouc,项目名称:wordpress2,代码行数:58,代码来源:popular_posts.php

示例8: widget

        function widget($args, $instance)
        {
            //defaults
            $instance = wp_parse_args($instance, array("title" => "", "categories" => "", "count" => "", "limit" => "", "show_thumbnails" => "", "show_excerpt" => "", "thumb_width" => "", "thumb_height" => ""));
            extract($args);
            $title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : "";
            $categories = !empty($instance['categories']) ? implode($instance['categories'], ',') : "";
            $count = !empty($instance['count']) ? $instance['count'] : 5;
            $limit = !empty($instance['limit']) ? $instance['limit'] : 100;
            $show_thumbnails = !empty($instance['show_thumbnails']) ? $instance['show_thumbnails'] : "";
            $show_excerpt = !empty($instance['show_excerpt']) ? $instance['show_excerpt'] : "";
            $thumb_width = !empty($instance['thumb_width']) ? $instance['thumb_width'] : 260;
            $thumb_height = !empty($instance['thumb_height']) ? $instance['thumb_height'] : 260;
            $comment = "";
            //remove aside and quote post formats from the list
            $postargs = array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
            $post_query = new WP_Query($postargs);
            $rt_posts = '';
            if ($post_query->have_posts()) {
                while ($post_query->have_posts()) {
                    $post_query->the_post();
                    $post_title = get_the_title();
                    $link = get_permalink();
                    $date = get_the_time('d M Y');
                    $comment_count = get_comment_count($post_query->post->ID);
                    $featured_image_id = get_post_thumbnail_id();
                    $get_the_excerpt = $show_excerpt ? '<p>' . wp_html_excerpt(get_the_excerpt(), $limit) . '...</p>' : "";
                    // Create thumbnail image
                    $thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $thumb_width, "h" => $thumb_height, "crop" => 1, "class" => "post-thumb")) : "";
                    if (empty($thumbnail_image_output) || !empty($show_thumbnails)) {
                        $thumbnail_image_output = "";
                    }
                    if ($comment_count['approved'] > 0) {
                        if ($comment_count['approved'] > 1) {
                            $comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
                        } else {
                            $comments = __('1 Comment', 'rt_theme');
                        }
                        $comment = ' | <span class="comment_number"><span class="icon-comment-empty"></span><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comment_count['approved'] . '</a></span>';
                    }
                    $rt_posts .= sprintf('
				<div>
					%1$s
						<a class="title" href="%2$s" title="%3$s" rel="bookmark">%3$s</a>
						<span class="meta">%4$s %6$s</span>
					%5$s
				</div>
			', $thumbnail_image_output, $link, $post_title, get_the_date(), $get_the_excerpt, $comment);
                }
                wp_reset_postdata();
            }
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo $rt_posts;
            echo $after_widget;
        }
开发者ID:ryan-konkolewski,项目名称:rt-theme-19-extentions-multisite,代码行数:58,代码来源:popular_posts.php

示例9: lady_B_post_footer

/**
 * Prints HTML with article's footer. 
 * 
 */
function lady_B_post_footer($show_comments_template = false, $show_no_comment_info = true)
{
    //check comments
    $num_comments = get_comments_number();
    // get_comments_number returns only a numeric value
    if (comments_open()) {
        if ($num_comments == 0) {
            $comments = __('No comments', 'lady_B');
        } elseif ($num_comments > 1) {
            $comments = $num_comments . __(' comments', 'lady_B');
        } else {
            $comments = __('1 comment', 'lady_B');
        }
        $comments_txt = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
    } else {
        if ($show_no_comment_info) {
            $comments_txt = __('Comments are off for this post.', 'lady_B');
        } else {
            $comments_txt = '';
        }
    }
    //check tags
    $separator = ', ';
    $posttags = get_the_tags();
    $mtags = "";
    if ($posttags) {
        $mtags = __('Tags: ', 'lady_B');
        foreach ($posttags as $tag) {
            $mtags .= '<a href="' . esc_url(get_tag_link($tag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts tagged %s', 'lady_B'), $tag->name)) . '">' . esc_html($tag->name) . '</a>' . $separator;
        }
        $mtags .= "<br/>";
    }
    //check categories
    $mcat = "";
    $postcat = get_the_category();
    if ($postcat) {
        $mcat = __('In: ', 'lady_B');
        foreach ($postcat as $category) {
            $mcat .= '<a href="' . esc_url(get_category_link($category->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'lady_B'), $category->name)) . '">' . esc_html($category->name) . '</a>' . $separator;
        }
    }
    //we need different layout for single.php
    if ($show_comments_template) {
        $template = "";
        if (comments_open() || get_comments_number()) {
            ob_start();
            comments_template();
            $template = ob_get_contents();
            // Store buffer in variable
            ob_end_clean();
        }
        print "</div><!--end of entry--><footer><p class='more'>" . $mtags . $mcat . "</p><p class='comments'>" . $comments_txt . "</p>" . $template . "</footer></article><!--end of post-->";
    } else {
        print "</div><!--end of entry--><footer><p class='comments'>" . $comments_txt . "</p><p class='more'>" . $mtags . $mcat . "</p></footer></article><!--end of post-->";
    }
}
开发者ID:pmarki,项目名称:lady_B-wordpress,代码行数:60,代码来源:template-parts.php

示例10: comments_link

function comments_link($zero = false, $one = false, $more = false, $class = '', $none = false)
{
    // Default values lifted from WordPress core
    if (false === $zero) {
        $zero = esc_html__('No Comments', 'ubik');
    }
    if (false === $one) {
        $one = esc_html__('1 Comment', 'ubik');
    }
    if (false === $more) {
        $more = esc_html__('% Comments', 'ubik');
    }
    if (false === $none) {
        $none = esc_html__('Comments Off', 'ubik');
    }
    // Setup everything we need using WordPress core functions where appropriate
    $id = get_the_ID();
    $number = get_comments_number($id);
    $href = get_comments_link($id);
    $text = get_comments_number_text($zero, $one, $more);
    // Custom class handling; automatically add a `comments-link` class but allow for themes to override this
    $class = apply_filters('ubik_comments_link_class', trim('comments-link ' . $class));
    // Password-protected content
    if (post_password_required()) {
        if (option('comments_link_protected')) {
            $href = '';
            // The link will be displayed with all relevant information but no interaction will be possible
            $class .= ' disabled';
        } else {
            return;
            // No link will be displayed
        }
    }
    // No comments found
    if ($number == 0) {
        // Comments and pingbacks are closed AND there aren't any comments
        if (!comments_open() && !pings_open()) {
            if (option('comments_link_show_none')) {
                $text = $none;
                // Switch the text to show "Comments Off"
                $href = '';
                // Disable the link (otherwise we'd be linking to content that doesn't exist)
                $class .= ' disabled';
            } else {
                return;
                // No button will be displayed
            }
        } else {
            $href = get_permalink() . '#respond';
            // Link to the response form, not the comments area as a whole
        }
    }
    // Assemble the comments link markup
    return sprintf('<a%s%s>%s</a>', $href ? sprintf(' href="%s"', esc_url($href)) : '', $class ? sprintf(' class="%s"', esc_attr($class)) : '', apply_filters('ubik_comments_link_text', $text));
}
开发者ID:synapticism,项目名称:ubik,代码行数:55,代码来源:main.php

示例11: ut_get_comments_popup_link

 function ut_get_comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
 {
     global $wpcommentspopupfile, $wpcommentsjavascript;
     $id = get_the_ID();
     if (false === $zero) {
         $zero = __('No Comments', 'ut_shortcodes');
     }
     if (false === $one) {
         $one = __('1 Comment', 'ut_shortcodes');
     }
     if (false === $more) {
         $more = __('% Comments', 'ut_shortcodes');
     }
     if (false === $none) {
         $none = __('Comments Off', 'ut_shortcodes');
     }
     $number = get_comments_number($id);
     $str = '';
     if (0 == $number && !comments_open() && !pings_open()) {
         $str = '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
         return $str;
     }
     if (post_password_required()) {
         $str = __('Enter your password to view comments.', 'ut_shortcodes');
         return $str;
     }
     $str = '<a href="';
     if ($wpcommentsjavascript) {
         if (empty($wpcommentspopupfile)) {
             $home = home_url();
         } else {
             $home = get_option('siteurl');
         }
         $str .= $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
         $str .= '" onclick="wpopen(this.href); return false"';
     } else {
         // if comments_popup_script() is not in the template, display simple comment link
         if (0 == $number) {
             $str .= get_permalink() . '#respond';
         } else {
             $str .= get_comments_link();
         }
         $str .= '"';
     }
     if (!empty($css_class)) {
         $str .= ' class="' . $css_class . '" ';
     }
     $title = the_title_attribute(array('echo' => 0));
     $str .= apply_filters('comments_popup_link_attributes', '');
     $str .= ' title="' . esc_attr(sprintf(__('Comment on %s'), $title)) . '">';
     $str .= ut_get_comments_number_str($zero, $one, $more);
     $str .= '</a>';
     return $str;
 }
开发者ID:waqasraza123,项目名称:wpgeeks,代码行数:54,代码来源:ut.shortcode.functions.php

示例12: widget

 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $categories = empty($instance['categories']) ? $instance['categories'] : implode($instance['categories'], ',');
     $count = empty($instance['count']) ? 5 : $instance['count'];
     $limit = empty($instance['limit']) ? 100 : $instance['limit'];
     $show_thumbnails = $instance['show_thumbnails'];
     $show_excerpt = $instance['show_excerpt'];
     $thumb_width = empty($instance['thumb_width']) ? 50 : $instance['thumb_width'];
     $thumb_height = empty($instance['thumb_height']) ? 50 : $instance['thumb_height'];
     $comment = "";
     //remove aside and quote post formats from the list
     $postargs = array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
     $post_query = new WP_Query($postargs);
     $rt_posts = '<div class="recent_posts clearfix"><ul>';
     if ($post_query->have_posts()) {
         while ($post_query->have_posts()) {
             $post_query->the_post();
             $post_title = get_the_title();
             $link = get_permalink();
             $date = get_the_time('d M Y');
             $comment_count = get_comment_count($post_query->post->ID);
             $featured_image_id = get_post_thumbnail_id();
             // Create thumbnail image
             $thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $thumb_width, "h" => $thumb_height, "crop" => 1, "class" => "recent-posts-thumb")) : "";
             $rt_posts .= '<li class="clearfix">';
             if ($thumbnail_image_output && !$show_thumbnails) {
                 $rt_posts .= $thumbnail_image_output;
             }
             if ($comment_count['approved'] > 0) {
                 if ($comment_count['approved'] > 1) {
                     $comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
                 } else {
                     $comments = __('1 Comment', 'rt_theme');
                 }
                 $comment = ' <span class="comment_number"><span class="icon-comment-empty"></span><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comment_count['approved'] . '</a></span>';
             }
             $rt_posts .= '<span class="title"><a href="' . $link . '">' . $post_title . '</a></span>';
             $rt_posts .= '<div class="widget-meta"><span class="date">' . $date . '</span> ' . $comment . '</div>';
             $rt_posts .= $show_excerpt ? '' . wp_html_excerpt(get_the_excerpt(), $limit) . '...' . '<div class="space margin-b10"></div>' : "";
             $rt_posts .= '</li>';
         }
     }
     wp_reset_query();
     $rt_posts .= '</ul></div>';
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo $rt_posts;
     echo $after_widget;
 }
开发者ID:nikolaev-k,项目名称:alwadi,代码行数:53,代码来源:popular_posts.php

示例13: x_integrity_entry_meta

 function x_integrity_entry_meta()
 {
     $author = sprintf('<span><i class="x-icon-pencil"></i> %s</span>', get_the_author());
     $date = sprintf('<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar"></i> %2$s</time></span>', esc_attr(get_the_date('c')), esc_html(get_the_date()));
     if (get_post_type() == 'x-portfolio') {
         if (has_term('', 'portfolio-category', NULL)) {
             $categories = get_the_terms(get_the_ID(), 'portfolio-category');
             $separator = ', ';
             $categories_output = '';
             foreach ($categories as $category) {
                 $categories_output .= '<a href="' . get_term_link($category->slug, 'portfolio-category') . '" title="' . esc_attr(sprintf(__("View all posts in: &ldquo;%s&rdquo;", '__x__'), $category->name)) . '"><i class="x-icon-bookmark"></i> ' . $category->name . '</a>' . $separator;
             }
             $categories_list = sprintf('<span>%s</span>', trim($categories_output, $separator));
         } else {
             $categories_list = '';
         }
     } else {
         $categories = get_the_category();
         $separator = ', ';
         $categories_output = '';
         foreach ($categories as $category) {
             $categories_output .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in: &ldquo;%s&rdquo;", '__x__'), $category->name)) . '"><i class="x-icon-bookmark"></i> ' . $category->name . '</a>' . $separator;
         }
         $categories_list = sprintf('<span>%s</span>', trim($categories_output, $separator));
     }
     if (comments_open()) {
         $title = get_the_title();
         $link = get_comments_link();
         $number = get_comments_number();
         if ($number == 0) {
             $comments = sprintf('<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>', esc_url($link), esc_attr(sprintf(__('Leave a comment on: &ldquo;%s&rdquo;', '__x__'), $title)), __('Leave a Comment', '__x__'));
         } else {
             if ($number == 1) {
                 $comments = sprintf('<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>', esc_url($link), esc_attr(sprintf(__('Leave a comment on: &ldquo;%s&rdquo;', '__x__'), $title)), $number . ' ' . __('Comment', '__x__'));
             } else {
                 $comments = sprintf('<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments"></i> %3$s</a></span>', esc_url($link), esc_attr(sprintf(__('Leave a comment on: &ldquo;%s&rdquo;', '__x__'), $title)), $number . ' ' . __('Comments', '__x__'));
             }
         }
     } else {
         $comments = '';
     }
     $post_type = get_post_type();
     $post_type_post = $post_type == 'post';
     $post_type_portfolio = $post_type == 'x-portfolio';
     $no_post_meta = get_theme_mod('x_blog_enable_post_meta') == 0;
     $no_portfolio_meta = get_theme_mod('x_portfolio_enable_post_meta') == 0;
     if ($post_type_post && $no_post_meta || $post_type_portfolio && $no_portfolio_meta) {
         return;
     } else {
         printf('<p class="p-meta">%1$s%2$s%3$s%4$s</p>', $author, $date, $categories_list, $comments);
     }
 }
开发者ID:Cywaithaka,项目名称:WPAN,代码行数:52,代码来源:integrity.php

示例14: distinctpress_post_comments

/** DistinctPress Post Comments */
function distinctpress_post_comments()
{
    if (!comments_open() || post_password_required()) {
        return;
    }
    ob_start();
    comments_number(__('Leave a Comment', 'distinctpress'), __('1 Comment', 'distinctpress'), __('% Comments', 'distinctpress'));
    $comments = ob_get_clean();
    /** Output */
    $comments = sprintf('<a href="%s"><i class="el-icon-comment meta-icon"></i>%s</a>', esc_url(get_comments_link()), $comments);
    $output = sprintf('<span class="entry-meta-sep"> &sdot; </span><span class="comments-link">%1$s</span>', $comments);
    return $output;
}
开发者ID:phatboyg,项目名称:phatboyg.github.io,代码行数:14,代码来源:utility.php

示例15: contango_post_comments

/** Contango Post Comments */
function contango_post_comments()
{
    if (!comments_open() || post_password_required()) {
        return;
    }
    ob_start();
    comments_number(__('Leave a Comment', 'contango'), __('1 Comment', 'contango'), __('% Comments', 'contango'));
    $comments = ob_get_clean();
    /** Output */
    $comments = sprintf('<a href="%s">%s</a>', esc_url(get_comments_link()), $comments);
    $output = sprintf('%2$s<span class="comments-link">%1$s</span>', $comments, contango_entry_meta_sep());
    return $output;
}
开发者ID:alextkd,项目名称:fdsmc,代码行数:14,代码来源:utility.php


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