[wp-trac] [WordPress Trac] #34110: WordPress Trackback Bug when Comment Pagination is Enabled
WordPress Trac
noreply at wordpress.org
Sun Jun 5 20:01:04 UTC 2016
#34110: WordPress Trackback Bug when Comment Pagination is Enabled
-------------------------------+------------------------------
Reporter: isaumya | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 4.3.1
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by isaumya):
Replying to [comment:4 rachelbaker]:
> @isaumya Greetings, and thanks for the ticket. I understand you filed
this ticket some time ago, but I hoping you can provide some more
information.
>
> It sounds as though the global `$current_comment` is getting corrupted
because you are outputting the results of `wp_list_comments()` twice
within the `have_comments()` check. Can you share the code you are using
in your comments.php template file? I am particularly curious about how
and where exactly you are placing the comment pagination.
Hi, Thanks for your reply. I would be more than happy to share my code
with you guys. I'm pasting it below. Also if you want I can give you some
of my article links where you can see the problems happening live (still
now). But I'm not posting those links in this comment now because I'm not
sure that is allowed as per your bug reporting rule. So if you tell me,
will share some of my comments in my next comment. For now, here is the
code og my `comments.php` page
{{{#!php
<?php
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() )
return;
?>
<div class="comments-section <?php if ( '0' == get_comments_number() ) {
echo "no-comments"; } ?>">
<div id="comments">
<div class="comments-wrap">
<?php if ( have_comments() ) : ?>
<?php do_action(
'new_comments_section_title' ); ?>
<?php endif; ?>
<ol class="commentlist">
<?php wp_list_comments( array( "callback"
=> "checkout_comment", "type" => "comment") ); ?>
</ol>
<?php if ( get_comment_pages_count() > 1 &&
get_option( 'page_comments' ) ) : // are there comments to navigate
through ?>
<nav id="comment-nav-below"
role="navigation">
<?php paginate_comments_links();
?>
</nav>
<?php endif; // check for comment navigation ?>
<?php if ( ! comments_open() &&
get_comments_number() ) : ?>
<?php if( is_singular( 'download' ) ) : ?>
<p class="no-comments"><?php _e(
'Only a buyer can review the product.' , 'checkout' ); ?></p>
<?php else : ?>
<p class="no-comments"><?php _e(
'Comments are closed.' , 'checkout' ); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php $trackback_count = get_comments( array(
'status' => 'approve',
'post_id'=> get_the_ID(),
'type'=> 'pings',
'count' => true)
);
if ( $trackback_count > 0 ) : ?>
<hr class="hrdesign" />
<h3 id="comments-title" class="trackback-
heading"><?php printf( _nx( '1 mention so far', '%1$s mentions so far',
$trackback_count, 'comments title', 'checkout' ), number_format_i18n(
$trackback_count ) ); ?></h3>
<ol class="commentlist">
<?php wp_list_comments( array(
"callback" => "checkout_comment", "type" => "pings", "reply_text" => null,
"format" => "html5") ); ?>
</ol>
<?php endif; ?>
<?php //$form_args = array( 'title_reply' => '' );
?>
<?php
if( is_singular( 'download' ) ) {
comment_form( array( 'title_reply'
=> 'Share your review', 'label_submit' => 'Post my review' ) );
} else {
comment_form( array( 'title_reply'
=> 'Share your thoughts', 'label_submit' => 'Post my thoughts' ) );
}
?>
</div><!-- .comments-wrap -->
</div><!-- #comments -->
</div><!-- .comments-section -->
}}}
P.S.: One of the thing that I'm really surprised to see is that Genesis
have been using this comment & ping dividation for years now (though I'm
not using it on my site) and it is a very popular framework which also has
the same problem (I've tested) as this is a WordPress core issue, but no
one has reported this. Very wired!
Anyways, thanks a lot for looking into this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34110#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list