本文整理汇总了PHP中comments_number函数的典型用法代码示例。如果您正苦于以下问题:PHP comments_number函数的具体用法?PHP comments_number怎么用?PHP comments_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了comments_number函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restful_post_meta_above
/**
* Post meta for above the post.
*/
function restful_post_meta_above()
{
global $post;
?>
<div class="entry__meta-item">
<i class="fa fa-calendar"></i>
<a href="<?php
esc_url(get_permalink());
?>
"><?php
the_time(get_option('date_format'));
?>
</a>
</div>
<div class="entry__meta-item">
<i class="fa fa-user"></i>
<a href="<?php
echo esc_url(get_author_posts_url($post->post_author));
?>
"><?php
the_author_meta('display_name', $post->post_author);
?>
</a>
</div>
<?php
if (comments_open() || have_comments()) {
?>
<div class="entry__meta-item">
<i class="fa fa-comment"></i>
<a href="<?php
esc_url(comments_link());
?>
"><?php
comments_number();
?>
</a>
</div>
<?php
}
?>
<?php
}
示例2: tpp_posts_widget
function tpp_posts_widget()
{
$tpp_posts_query = new WP_Query();
$tpp_posts_query->query('&posts_per_page=10&orderby=comment_count&order=DESC');
?>
<h3>Posts on this page:</h3>
<?php
if ($tpp_posts_query->have_posts()) {
while ($tpp_posts_query->have_posts()) {
$tpp_posts_query->the_post();
?>
<a href="<?php
echo the_permalink();
?>
"
title="<?php
echo the_title();
?>
"><?php
echo the_title();
?>
</a>
(<?php
echo comments_number();
?>
) <br />
<?php
}
}
?>
<?php
}
示例3: tpp_posts_widget
function tpp_posts_widget()
{
$tpp_posts_query = new WP_Query(array('posts_per_page' => 10, 'orderby' => 'comment_count', 'order' => 'DESC', 'post__in' => get_option('sticky_posts')));
?>
<h3><?php
_e('Posts on this page:');
?>
</h3>
<?php
if ($tpp_posts_query->have_posts()) {
while ($tpp_posts_query->have_posts()) {
$tpp_posts_query->the_post();
?>
<a href="<?php
echo the_permalink();
?>
"
title="<?php
echo the_title();
?>
"><?php
echo the_title();
?>
</a>
(<?php
echo comments_number();
?>
) <br />
<?php
}
}
?>
<?php
}
示例4: appointment_aside_meta_content
function appointment_aside_meta_content()
{
$current_options = get_option('appointment_options');
if ($current_options['meta_section_settings'] == 'on') {
?>
<!--show date of post-->
<aside class="blog-post-date-area">
<div class="date"><?php
echo get_the_date('j');
?>
<div class="month-year"><?php
echo get_the_date('M');
?>
,<?php
echo get_the_date('Y');
?>
</div></div>
<div class="comment"><a href="<?php
the_permalink();
?>
"><i class="fa fa-comments"></i><?php
comments_number('', 'o', '%');
?>
</a></div>
</aside>
<?php
}
}
示例5: kbe_custom_columns
function kbe_custom_columns($column)
{
global $post;
switch ($column) {
case "title":
the_title();
break;
case "author":
the_author();
break;
case "cat":
echo get_the_term_list($post->ID, 'kbe_taxonomy', ' ', ', ', '');
break;
case "tag":
echo get_the_term_list($post->ID, 'kbe_tags', ' ', ', ', '');
break;
case "comment":
comments_number(__('No Comments', 'kbe'), __('1 Comment', 'kbe'), __('% Comments', 'kbe'));
break;
case "views":
$views = get_post_meta($post->ID, 'kbe_post_views_count', true);
if ($views) {
echo $views . __(' Views', 'kbe');
} else {
echo __('No Views', 'kbe');
}
break;
case "date":
the_date();
break;
}
}
示例6: tpp_posts_widget
function tpp_posts_widget()
{
?>
<h3>Posts on this page:</h3>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<div>
<a href="<?php
echo the_permalink();
?>
"
title="<?php
echo the_title();
?>
"><?php
echo the_title();
?>
</a>
(<?php
echo comments_number();
?>
)
</div>
<?php
}
}
?>
<?php
}
示例7: matraman_lite_comments
function matraman_lite_comments()
{
global $post;
echo '<span class="comment"><i class="icon icon-chatbubble"></i>';
comments_number('No Comment', '1 Comment', '% Comments');
echo '</span>';
}
示例8: appointment_aside_meta_content
function appointment_aside_meta_content()
{
$appointment_options = theme_setup_data();
$news_setting = wp_parse_args(get_option('appointment_options', array()), $appointment_options);
if ($news_setting['home_meta_section_settings'] == '') {
?>
<!--show date of post-->
<aside class="blog-post-date-area">
<div class="date"><?php
echo get_the_date('j');
?>
<div class="month-year"><?php
echo get_the_date('M');
?>
,<?php
echo get_the_date('Y');
?>
</div></div>
<div class="comment"><a href="<?php
the_permalink();
?>
"><i class="fa fa-comments"></i><?php
comments_number('0', '1', '%');
?>
</a></div>
</aside>
<?php
}
}
示例9: custom_columns
/**
* Display of Custom Post Type Columns
* @param array $column
* @since 1.0.0
*/
public function custom_columns($column)
{
global $post;
switch ($column) {
case 'title':
the_title();
break;
case 'author':
the_author();
break;
case 'cat':
echo get_the_term_list($post->ID, 'docu_cat', ' ', ', ', '');
break;
case 'tag':
echo get_the_term_list($post->ID, 'docu_tag', ' ', ', ', '');
break;
case 'comment':
comments_number(__('No Comments', 'documentate'), __('1 Comment', 'documentate'), __('% Comments', 'documentate'));
break;
case 'views':
$views = get_post_meta($post->ID, 'documentate_post_views_count', true);
if ($views) {
printf(_n('%s view', '%s views', $rating, 'documentate'), $views);
} else {
echo __('No Views', 'documentate');
}
break;
case 'date':
the_date();
break;
}
}
示例10: widget
function widget($args, $instance)
{
extract($args);
@($title = $instance['title'] ? $instance['title'] : '最热文章');
@($num = $instance['num'] ? $instance['num'] : 5);
echo $before_widget;
?>
<div class="panel panel-zan hidden-xs">
<div class="panel-heading"><?php
echo $title;
?>
</div>
<div class="panel-body">
<ul class="list-group">
<?php
// 设置全局变量,实现post整体赋值
global $post;
$posts = zan_get_hotest_posts($num);
foreach ($posts as $post) {
setup_postdata($post);
?>
<li class="zan-list clearfix">
<figure class="thumbnail zan-thumb">
<?php
the_post_thumbnail(array(75, 75));
?>
</figure>
<a href="<?php
the_permalink();
?>
">
<h5><?php
the_title();
?>
</h5>
</a>
<div class="sidebar-info">
<span><i class="fa fa-calendar"></i> <?php
the_time('m月j日, Y');
?>
</span>
<span><i class="fa fa-comment"></i> <a href="<?php
the_permalink();
?>
#comments"><?php
comments_number('0', '1', '%');
?>
</a></span>
</div>
</li>
<?php
}
wp_reset_postdata();
?>
</ul>
</div>
</div>
<?php
echo $after_widget;
}
示例11: webonary_zeedisplay_display_entry_header
/**
* Display common postmeta information. The parent theme originally showed
* date, author, and a comment link.
*/
function webonary_zeedisplay_display_entry_header()
{
$options = get_option('themezee_options');
if (isset($options['themeZee_blog_mode']) and $options['themeZee_blog_mode'] == BLOG_MODE) {
?>
<div class="postmeta">
<span class="date"><a href="<?php
the_permalink();
?>
"><?php
the_time(get_option('date_format'));
?>
</a></span>
<span class="author"><?php
the_author();
?>
</span>
<span class="comment"><a href="<?php
the_permalink();
?>
#comments"><?php
comments_number(__('No comments', ZEE_LANG), __('One comment', ZEE_LANG), __('% comments', ZEE_LANG));
?>
</a></span>
</div>
<?php
}
}
示例12: formatAttribute
function formatAttribute()
{
global $post;
?>
<ul class="post-in">
<li>
<?php
esc_html_e("Posted In : ", "charity");
the_category(" , ");
$tags = get_tags();
if (!empty($tags)) {
the_tags(" , ");
}
?>
</li>
<li>
<a href="<?php
comments_link();
?>
"><?php
comments_number('0 : comment', '1 : comment', '% : comments');
?>
</a>
</li>
</ul>
<?php
}
示例13: widget
/**
* Front-end display of widget
**/
public function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', isset($instance['title']) ? esc_attr($instance['title']) : '');
$items_num = isset($instance['items_num']) ? esc_attr($instance['items_num']) : '';
/**
* Posts by comment count
**/
global $post;
$ti_most_commented = new WP_Query(array('post_type' => 'post', 'order' => 'DECS', 'orderby' => 'comment_count', 'posts_per_page' => $items_num));
if ($ti_most_commented->have_posts()) {
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<ul>
<?php
$com = 1;
?>
<?php
while ($ti_most_commented->have_posts()) {
$ti_most_commented->the_post();
?>
<li class="clearfix score-<?php
echo $com++;
?>
">
<span>
<i><?php
comments_number('0', '1', '%');
?>
</i>
</span>
<a href="<?php
the_permalink();
?>
">
<?php
if (strlen($post->post_title) > 30) {
echo substr(the_title($before = '', $after = '', FALSE), 0, 30) . '...';
} else {
the_title();
}
?>
</a>
</li>
<?php
}
$com++;
?>
</ul>
<?php
echo $after_widget;
wp_reset_postdata();
}
}
示例14: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<ul class="post-list">
<?php
query_posts('post_type=post&posts_per_page=' . $instance['amount'] . '&orderby=comment_count&order=DESC');
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<li>
<figure class="frame pull-left">
<div class="icon-overlay"><a href="<?php
the_permalink();
?>
"><span class="icn-more"></span><?php
the_post_thumbnail('thumbnail');
?>
</a></div>
</figure>
<div class="meta"> <em><span class="date"><?php
the_time(get_option('date_format'));
?>
</span>
<span class="comments"><a href="<?php
comments_link();
?>
"><?php
comments_number('0', '1', '%');
?>
<i class="icon-chat-1"></i></a></span></em>
<h5><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h5>
</div>
</li>
<?php
}
}
wp_reset_query();
?>
</ul>
<?php
echo $after_widget;
}
示例15: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? 'Popular This Week' : $instance['title']);
$postsNum = empty($instance['postsNum']) ? '' : (int) $instance['postsNum'];
$show_thisweek = isset($instance['thisweek']) ? (bool) $instance['thisweek'] : false;
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
$additional_query = $show_thisweek ? '&year=' . date('Y') . '&w=' . date('W') : '';
query_posts('post_type=post&posts_per_page=' . $postsNum . '&orderby=comment_count&order=DESC' . $additional_query);
?>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<div class="blog-entry">
<a href="<?php
the_permalink();
?>
" class="comments"><?php
comments_number('0', '1', '%');
?>
</a>
<h4 class="title"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h4>
<p class="meta-info"><?php
esc_html_e('Posted', 'Aggregate');
?>
<?php
esc_html_e('by', 'Aggregate');
?>
<?php
the_author_posts_link();
?>
<?php
esc_html_e('on', 'Aggregate');
?>
<?php
the_time('n-j-y');
?>
</p>
</div>
<?php
}
}
wp_reset_query();
?>
<?php
echo $after_widget;
}