本文整理汇总了PHP中get_comments_number函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comments_number函数的具体用法?PHP get_comments_number怎么用?PHP get_comments_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_comments_number函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twentysixteen_entry_meta
function twentysixteen_entry_meta()
{
ob_start();
if ('post' === get_post_type()) {
ob_start();
twentysixteen_entry_date();
$postedOn = ob_get_clean();
$author_avatar_size = apply_filters('twentysixteen_author_avatar_size', 49);
printf('<div class="name-date"><div class="name"><span class="screen-reader-text">%2$s </span> <a class="url fn n" href="%3$s">%4$s</a></div><div class="date">%5$s</div></div><div class="avatar">%1$s</div>', get_avatar(get_the_author_meta('user_email'), $author_avatar_size), _x('Author', 'Used before post author name.', 'twentysixteen'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author(), $postedOn);
}
if (in_array(get_post_type(), array('attachment'))) {
twentysixteen_entry_date();
}
$authordate = ob_get_clean();
printf('<div class="author-date">%s</div>', $authordate);
$format = get_post_format();
if (current_theme_supports('post-formats', $format)) {
printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentysixteen')), esc_url(get_post_format_link($format)), get_post_format_string($format));
}
echo '<div class="taxonomies">';
if ('post' === get_post_type()) {
twentysixteen_entry_taxonomies();
}
echo '</div>';
if (!is_singular() && !post_password_required() && (comments_open() || get_comments_number())) {
echo '<span class="comments-link">';
comments_popup_link(sprintf(__('Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentysixteen'), get_the_title()));
echo '</span>';
}
}
示例2: 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.
}
示例3: flatbook_post_metas
function flatbook_post_metas()
{
$user = get_the_author();
$date = get_the_date('F j');
$cats = get_the_category();
$tags = get_the_tags();
$comm = get_comments_number();
$type = get_post_format();
if (false === $type) {
$type = __('standard', 'flatbook');
}
echo '<div class="entry-metas">';
if ($type) {
echo '<span class="format"><i class="fa fa-inbox"></i>' . $type . '</span>';
}
if ($date) {
echo '<span class="posted-on"><i class="fa fa-dashboard"></i>' . $date . '</span>';
}
if ($user) {
echo '<span class="byline"><i class="fa fa-user"></i>' . $user . '</span>';
}
if ($cats) {
echo '<span class="cats"><i class="fa fa-folder-open"></i>' . $cats[0]->cat_name . '</span>';
}
if ($tags) {
echo '<span class="tags"><i class="fa fa-tags"></i>' . $tags[0]->name . '</span>';
}
if ($comm) {
echo '<span class="comments"><i class="fa fa-comments"></i>' . $comm . __(' Comment', 'flatbook') . '</span>';
}
echo '</div>';
}
示例4: pleiadesweb_posted_on
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function pleiadesweb_posted_on()
{
// 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('<i class="fa fa-calendar"></i>' . esc_html_x(' %s', 'post date', 'pleiadesweb'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
// AUTHOR
$byline = sprintf(esc_html_x('| escrito por %s', 'post author', 'pleiadesweb'), '<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>');
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
// CATEGORIES
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(esc_html__(', ', 'pleiadesweb'));
if ($categories_list && pleiadesweb_categorized_blog()) {
echo ' | </i><span class="category-list">' . $categories_list . '</span>';
}
// COMMENTS
if (!post_password_required() && (comments_open() || '0' != get_comments_number())) {
echo ' | <span class="comments-link">';
comments_popup_link(__('Deja un comentario', 'my-simone'), __('1 comentario', 'my-simone'), __('% comentarios', 'my-simone'));
echo '</span>';
}
//!post_password_required()
}
示例5: wpsr_floatingbts_commentbt
function wpsr_floatingbts_commentbt($args)
{
global $post;
$defaults = array('type' => 'vertical');
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
$comments_num = get_comments_number();
if (comments_open()) {
if ($type == 'vertical') {
return '<div class="wpsr_commentsbt">
<div class="wpsr_cmt_bubble" title="Comments"><a href="' . get_comments_link() . '">' . $comments_num . '</a></div>
<div class="wpsr_cmt_button"><a href="' . get_comments_link() . '">Comment</a></div>
</div>';
} else {
if ($comments_num == 0) {
$comments = __('No Comments');
} elseif ($comments_num > 1) {
$comments = $comments_num . __(' Comments');
} else {
$comments = __('1 Comment');
}
return '<a href="' . get_comments_link() . '">' . $comments . '</a>';
}
} else {
return '';
}
}
示例6: presscore_display_related_projects
/**
* Display related projects.
*
*/
function presscore_display_related_projects()
{
global $post;
$html = '';
$config = presscore_get_config();
// if related projects turn on in theme options
if ($config->get('post.related_posts.enabled')) {
$terms = array();
switch ($config->get('post.related_posts.query.mode')) {
case 'custom':
$terms = $config->get('post.related_posts.query.terms');
break;
default:
$terms = wp_get_object_terms($post->ID, 'dt_portfolio_category', array('fields' => 'ids'));
}
if ($terms && !is_wp_error($terms)) {
$options = array('cats' => $terms, 'select' => 'only', 'post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'args' => array('posts_per_page' => intval($config->get('post.related_posts.query.posts_per_page')), 'post__not_in' => array(get_the_ID())));
$posts = presscore_get_posts_in_categories($options);
$portfolio_scroller = new Presscore_Portfolio_Posts_Scroller();
$portfolio_scroller->setup($posts, array('class' => 'related-projects slider-wrapper', 'width' => $config->get('post.related_posts.width'), 'height' => $config->get('post.related_posts.height'), 'show_title' => $config->get('post.related_posts.show.title'), 'show_excerpt' => $config->get('post.related_posts.show.description'), 'appearance' => 'under_image', 'padding' => 20, 'bg_under_projects' => false, 'content_aligment' => 'center', 'hover_animation' => 'fade', 'hover_bg_color' => 'accent', 'hover_content_visibility' => 'on_hoover', 'show_link' => $config->get('post.related_posts.show.link'), 'show_details' => $config->get('post.related_posts.show.details_link'), 'show_zoom' => $config->get('post.related_posts.show.zoom'), 'show_date' => $config->get('post.related_posts.meta.fields.date'), 'show_categories' => $config->get('post.related_posts.meta.fields.categories'), 'show_comments' => $config->get('post.related_posts.meta.fields.comments'), 'show_author' => $config->get('post.related_posts.meta.fields.author'), 'arrows' => 'accent'));
$html .= $portfolio_scroller->get_html();
if ($html) {
$html = '<div class="full-width-wrap">' . $html . '</div>';
// fancy separator
$html = presscore_fancy_separator(array('title' => $config->get('post.related_posts.title'), 'class' => 'fancy-projects-title')) . $html;
if (!(post_password_required() || !comments_open() && 0 == get_comments_number())) {
// add gap after projects
$html .= do_shortcode('[dt_gap height="40"]');
}
}
}
}
echo (string) apply_filters('presscore_display_related_projects', $html);
}
示例7: impronta_metadata
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function impronta_metadata()
{
// Hide category and tag text for pages.
if ('post' === get_post_type()) {
echo '<p class="metadata">';
$byline = sprintf(esc_html_x('By %s', 'post author', 'impronta'), '<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> ');
echo $byline;
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(esc_html__(', ', 'impronta'));
if ($categories_list && impronta_categorized_blog()) {
printf('<span class="cat-links">' . esc_html_x('on %1$s ', 'on categories', 'impronta') . '</span>', $categories_list);
// WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list('', esc_html__(', ', 'impronta'));
if ($tags_list) {
printf(esc_html__('tagged %1$s', 'impronta'), $tags_list);
// WPCS: XSS OK.
}
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
if (get_comments_number(get_the_id()) == 0) {
echo esc_html__('- ', 'impronta');
} else {
echo esc_html__('with ', 'impronta');
}
comments_popup_link(esc_html__('Leave a comment', 'impronta'), esc_html__('1 Comment', 'impronta'), esc_html__('% Comments', 'impronta'));
}
if (is_sticky()) {
echo ' - ' . '<i class="feature-star fa fa-star" data-toggle="tooltip" data-placement="right" title="' . esc_attr__('Featured Post', 'impronta') . '"></i>';
}
echo '</p>';
}
}
示例8: eighteen_tags_display_comments
/**
* Eighteen tags display comments
* @since 1.0.0
*/
function eighteen_tags_display_comments()
{
// If comments are open or we have at least one comment, load up the comment template
if (comments_open() || '0' != get_comments_number()) {
comments_template();
}
}
示例9: vca_comments_template
function vca_comments_template()
{
// If comments are open or we have at least one comment, load up the comment template
if (CA_Option::get('enable_comments', true) && (comments_open() || '0' != get_comments_number())) {
comments_template();
}
}
示例10: hacker_entry_footer
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function hacker_entry_footer()
{
// Hide category and tag text for pages.
?>
<div class="Article__meta pull-left">
<?php
if ('post' === get_post_type()) {
echo get_the_tag_list('<span class="post-tags"><i class="icon-tags"></i>', '', '</span>');
}
?>
</div>
<!-- END .pull-left -->
<div class="Article__meta pull-right">
<?php
$post_id = get_the_ID();
$likes = get_post_meta($post_id, '_likes', true);
$likes = absint($likes);
printf('<span><a href="#" class="js-rating" data-post="%1$s"><i class="icon-heart"></i><span class="js-count">%2$s</span></a></span>', $post_id, $likes);
if (!post_password_required() && (comments_open() || get_comments_number())) {
echo '<span><i class="icon-comments"></i><span>';
comments_popup_link(esc_html__('No Comment', 'hacker'), esc_html__('1 Comment', 'hacker'), esc_html__('% Comments', 'hacker'));
echo '</span></span>';
}
?>
</div>
<!-- END .pull-right -->
<?php
}
示例11: hocwp_theme_check_load_facebook_javascript_sdk
function hocwp_theme_check_load_facebook_javascript_sdk($use)
{
$data = apply_filters('hocwp_load_facebook_javascript_sdk_on_page_sidebar', array());
foreach ($data as $value) {
$conditional_functions = isset($value['condition']) ? $value['condition'] : '';
$conditional_functions = hocwp_sanitize_array($conditional_functions);
$condition_result = false;
foreach ($conditional_functions as $function) {
if (!hocwp_callback_exists($function)) {
continue;
}
if (call_user_func($function)) {
$condition_result = true;
break;
}
}
$sidebar = isset($value['sidebar']) ? $value['sidebar'] : '';
$sidebars = hocwp_sanitize_array($sidebar);
foreach ($sidebars as $sidebar) {
if (is_active_sidebar($sidebar) && $condition_result && hocwp_sidebar_has_widget($sidebar, 'hocwp_widget_facebook_box')) {
return true;
}
}
}
$comment_system = hocwp_theme_get_option('comment_system', 'discussion');
if ('facebook' == $comment_system || 'default_and_facebook' == $comment_system || 'tabs' == $comment_system) {
if (is_singular()) {
$post_id = get_the_ID();
if (comments_open($post_id) || get_comments_number($post_id)) {
return true;
}
}
}
return $use;
}
示例12: directory_theme_entry_meta
function directory_theme_entry_meta()
{
if (is_sticky() && is_home() && !is_paged()) {
printf('<span class="sticky-post">%s</span>', __('Featured', 'directory-starter'));
}
$format = get_post_format();
if (current_theme_supports('post-formats', $format)) {
printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'directory-starter')), esc_url(get_post_format_link($format)), get_post_format_string($format));
}
if (in_array(get_post_type(), array('post', 'attachment'))) {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
$time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date());
printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'directory-starter'), esc_url(get_permalink()), $time_string);
}
if ('post' == get_post_type()) {
if (is_singular() || is_multi_author()) {
printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'directory-starter'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
}
$categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter'));
if ($categories_list) {
printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'directory-starter'), $categories_list);
}
$tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter'));
if ($tags_list) {
printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'directory-starter'), $tags_list);
}
}
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
echo '<span class="comments-link">';
comments_popup_link(__('Leave a comment', 'directory-starter'), __('1 Comment', 'directory-starter'), __('% Comments', 'directory-starter'));
echo '</span>';
}
}
示例13: k2_asides_permalink
function k2_asides_permalink($content)
{
if (in_category(get_option('unwakeable_asidescategory')) and !is_singular()) {
$content .= '<a href="' . get_permalink() . '" rel="bookmark" class="asides-permalink" title="' . k2_permalink_title(false) . '">(' . get_comments_number() . ')</a>';
}
return $content;
}
示例14: sangeet_entry_footer
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function sangeet_entry_footer()
{
// Hide category and tag text for pages.
if ('post' === get_post_type()) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(esc_html__(', ', 'sangeet'));
if ($categories_list && sangeet_categorized_blog()) {
printf('<span class="cat-links">' . esc_html__('%1$s', 'sangeet') . '</span>', $categories_list);
// WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list('', esc_html__(', ', 'sangeet'));
if ($tags_list) {
printf('<span class="tags-links">' . esc_html__('%1$s', 'sangeet') . '</span>', $tags_list);
// WPCS: XSS OK.
}
}
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
echo '<span class="comments-link">';
comments_popup_link(esc_html__('Leave a comment', 'sangeet'), esc_html__('1 Comment', 'sangeet'), esc_html__('% Comments', 'sangeet'));
echo '</span>';
}
edit_post_link(sprintf(esc_html__('Edit %s', 'sangeet'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
if (!is_single()) {
echo '<span class="continue-reading"><a href="' . get_permalink() . '" title="' . esc_html__('Continue Reading ', 'sangeet') . get_the_title() . '" rel="bookmark">' . esc_html__('Continue Reading ', 'sangeet') . '</a></span>';
}
}
示例15: chroma_entry_footer
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function chroma_entry_footer()
{
// Hide category and tag text for pages.
echo '<footer class="entry-footer">';
if ('post' === get_post_type()) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list(esc_html__(', ', 'chroma'));
if ($categories_list && chroma_categorized_blog()) {
printf('<span class="cat-links"><i title="Categories..." class="fa fa-archive"></i>' . esc_html__(' %1$s', 'chroma') . '</span> ', $categories_list);
// WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list('', esc_html__(', ', 'chroma'));
if ($tags_list) {
printf('<span class="tags-links"><i title="Tags..." class="fa fa-hashtag"></i>' . esc_html__(' %1$s', 'chroma') . '</span> ', $tags_list);
// WPCS: XSS OK.
}
}
if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
echo '<span class="comments-link"><i title="Comments..." class="fa fa-commenting"></i> ';
comments_popup_link(esc_html__('Comment', 'chroma'), esc_html__('1 Comment', 'chroma'), esc_html__('% Comments', 'chroma'));
echo '</span>';
}
/* edit_post_link(
sprintf(
esc_html__( 'Edit %s', 'chroma' ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
),
'<span class="edit-link">',
'</span>'
);
*/
echo '</footer><!-- .entry-footer -->';
}