本文整理汇总了PHP中have_comments函数的典型用法代码示例。如果您正苦于以下问题:PHP have_comments函数的具体用法?PHP have_comments怎么用?PHP have_comments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了have_comments函数的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: comments_evolved_template
function comments_evolved_template($file)
{
global $post, $comments;
if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) {
return;
}
return COMMENTS_EVOLVED_TEMPLATES . '/container.php';
}
示例3: getCommentsTemplate
public function getCommentsTemplate($default_template)
{
global $wpdb, $post;
if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) {
return $default_template;
}
return dirname(__FILE__) . '/comments_sohu.php';
}
示例4: tabs_shortcode
function tabs_shortcode($atts, $content = null)
{
if (comments_open() || have_comments()) {
return '<div class="responsive-tabs content-tabs">' . do_shortcode($content) . '</div>';
} else {
return '<div class="responsive-tabs content-tabs">' . do_shortcode($content) . '</div><script>jQuery(document).ready(function() { RESPONSIVEUI.responsiveTabs(); }) </script>';
}
}
示例5: bpmagic_allow_comments_on_posts
/**
* Whether to allow comments on posts or not
*
* @global object $post
* @return boolean
*/
function bpmagic_allow_comments_on_posts()
{
global $post;
$show = 0;
if ('open' == $post->comment_status || have_comments()) {
$show = 1;
}
return apply_filters('bpmag_allow_comments_on_posts', $show);
//true by default
}
示例6: psp_comment_template
function psp_comment_template($comment_template)
{
global $post;
if (!(is_singular() && (have_comments() || 'open' == $post->comment_status))) {
return;
}
if ($post->post_type == 'psp_projects') {
// assuming there is a post type called business
return dirname(__FILE__) . '/templates/comments.php';
}
}
示例7: theme_comments_render_list
function theme_comments_render_list($callback)
{
?>
<?php
if (have_comments()) {
?>
<div class="cl"> </div>
<h3><?php
comments_number('Keine Antworten', 'Eine Antwort', '% Antworten');
?>
</h3>
<ol class="all-comments">
<?php
wp_list_comments('callback=' . $callback);
?>
</ol>
<?php
if (get_comment_pages_count() > 1 && get_option('page_comments')) {
// Are there comments to navigate through?
?>
<div class="navigation">
<div class="alignleft"><?php
previous_comments_link();
?>
</div>
<div class="alignright"><?php
next_comments_link();
?>
</div>
</div>
<?php
}
?>
<?php
} else {
?>
<?php
if (comments_open()) {
?>
<!-- If comments are open, but there are no comments. -->
<?php
} else {
// comments are closed
?>
<p class="nocomments">Kommentare sind geschlossen.</p>
<?php
}
?>
<?php
}
?>
<?php
}
示例8: tamatebako_post_format_aside_infinity
/**
* Adds an infinity character "∞" to the end of the post content on 'aside' posts.
*/
function tamatebako_post_format_aside_infinity($content)
{
if (has_post_format('aside') && !is_singular() && !post_password_required()) {
$infinity = '<a class="permalink" href="' . esc_url(get_permalink()) . '">∞</a>';
if (have_comments() || comments_open()) {
$infinity = '<a class="comments-link" href="' . esc_url(get_permalink()) . '">' . number_format_i18n(get_comments_number()) . '</a>';
}
$content .= ' ' . $infinity;
}
return $content;
}
示例9: ultimatum_do_pings
function ultimatum_do_pings() {
global $post, $wp_query;
if ( ! post_type_supports( $post->post_type, 'trackbacks' ) )
return;
if ( have_comments() && !empty( $wp_query->comments_by_type['pings'] ) ) {
?>
<div id="pings">
<?php echo apply_filters( 'ultimatum_title_pings', __( '<h3>Trackbacks</h3>', 'ultimatum' ) ); ?>
<ol class="ping-list">
<?php do_action( 'ultimatum_list_pings' ); ?>
</ol>
</div>
<?php
}
else {
echo apply_filters( 'ultimatum_no_pings_text', '' );
}
}
示例10: wptouch_the_post
<?php
if (wptouch_have_posts()) {
?>
<?php
wptouch_the_post();
?>
<?php
get_template_part('page-content');
?>
<?php
}
?>
</div> <!-- content -->
<?php
if (wptouch_fdn_show_comments_on_pages() && (comments_open() || have_comments())) {
?>
<div id="comments">
<?php
comments_template();
?>
</div>
<?php
}
?>
<?php
get_footer();
?>
<?php
示例11: esc_attr
data-width="<?php
echo esc_attr($WPFBC->get_width());
?>
"></div>
</div>
<?php
do_action('fb_after_fb_comments');
?>
<?php
do_action('fb_before_old_comments');
?>
<?php
if ($WPFBC->setting('show_old_comments', 'on') == 'on' && have_comments()) {
?>
<div class="navigation">
<div class="alignleft"><?php
previous_comments_link();
?>
</div>
<div class="alignright"><?php
next_comments_link();
?>
</div>
</div>
<?php
if (has_filter('fb_comments_template')) {
?>
示例12: cfct_banner
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
die;
}
if (CFCT_DEBUG) {
cfct_banner(__FILE__);
}
global $post, $wp_query, $comments, $comment;
if (have_comments() || 'open' == $post->comment_status) {
if (empty($post->post_password) || $_COOKIE['wp-postpass_' . COOKIEHASH] == $post->post_password) {
$comments = $wp_query->comments;
$comment_count = count($comments);
$comment_count == 1 ? $comment_title = __('One Response', 'carrington-blog') : ($comment_title = sprintf(__('%d Responses', 'carrington-blog'), $comment_count));
}
?>
<div class="rule-major"><hr /></div>
<h2 class="h1 comments-title"><?php
echo $comment_title;
?>
</h2>
<p><?php
示例13: get_comments
<?php
$total_count = get_comments(array('post_id' => $post->ID, 'type' => 'comment', 'count' => true, 'status' => 'approve'));
$comments = get_comments(array('type' => 'comment', 'post_id' => $post->ID, 'status' => 'approve'));
?>
<div id="comments" class="project-comments comments-area et-comments-area">
<?php
if (have_comments() && $total_count > 0) {
?>
<h3 class="title et-comments-title">
<?php
if ($total_count == 0) {
_e("0 Comments", 'comment-project');
} else {
if ($total_count == 1) {
printf(__("%d Comment", 'comment-project'), intval($total_count));
} else {
printf(__('%d Comments', 'comment-project'), $total_count);
}
}
?>
</h3>
<ol class="comment-list">
<?php
wp_list_comments(array('style' => 'ul', 'short_ping' => true, 'callback' => 'fre_project_comment_callback'), $comments);
?>
</ol><!-- .comment-list -->
<?php
示例14: thb_show_comments
function thb_show_comments($post_type = null)
{
global $post;
$comments_enabled = true;
// $custom_post_types = get_post_types( array('public' => true, '_builtin' => false) );
// if( !$post_type ) {
// $post_type = $post->post_type;
// }
// if( in_array($post_type, $custom_post_types) ) {
// $comments_enabled = thb_get_option($post_type . '_comments') == '1';
// }
return $comments_enabled && (have_comments() || comments_open());
}
示例15: printf
* return early without loading the comments.
*/
if (post_password_required()) {
return;
}
?>
<hr />
<div class="row">
<div id="comments" class="comments-area">
<?php
// You can start editing here -- including this comment!
?>
<?php
if (have_comments()) {
?>
<h2 class="comments-title columns large-12">
<?php
printf(_nx('One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'sennzaversion3'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>');
?>
</h2>
<?php
if (get_comment_pages_count() > 1 && get_option('page_comments')) {
// are there comments to navigate through
?>
<nav id="comment-nav-above" class="comment-navigation" role="navigation">
<h1 class="screen-reader-text"><?php
_e('Comment navigation', 'sennzaversion3');
?>