Support » Themes and Templates » Comments Submitted to Wrong Post

  • I’ve developed my own theme from scratch.
    – New comments are posted to the wrong post.
    – And after submitting a new comment visitors are diverted to a different post.

    An example of one of my posts is:

    Does anyone know how I can fix this? Thanks in advance.

    Not sure if this info will help.
    I call my comments as part of my footer.php file

    <?php $comments_args = array(
            'title_reply'=>'Submit A Comment',
            'comment_notes_after' => '',
    	'comment_notes_before' => '');
    comment_form($comments_args); ?>

    My main index file is very simple [and I don’t use single.php – all posts use the index.php]

    <?php get_header(); ?>
    <?php if (have_posts()) :
    while (have_posts()) :
    the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; else: ?>
    <p>Sorry, no posts we're found.</p>
    <?php endif; ?>
    <?php get_footer(); ?>

    My comments.php looks like this:

    <ul style="list-style: none; padding:0; margin:0;">
     <?php wp_list_comments( 'callback=garytheme_comments' ); ?> 
    <div class="comments-nav"><?php paginate_comments_links('prev_text= &next_text= ') ?> </div>

    Where the function called is in my functions.php file:

    function garytheme_comments($comment, $args, $depth) {
    		$GLOBALS['comment'] = $comment;
    		extract($args, EXTR_SKIP);
    <li><div id="div-comment-<?php comment_ID() ?>" class="comment-body">
    		<div class="comml"><?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?></div>
    		<div class="commr">Posted <?php comment_date('j-M-Y'); ?></div>
    <div class="comcom"><?php if ($comment->comment_approved == '0') : ?>
    		<em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?>
    <?php endif; ?>
    		<?php comment_text() ?></div>

    [please remember to mark any posted code – – the above codes might be broken/corrupted by the forum parser]

  • The topic ‘Comments Submitted to Wrong Post’ is closed to new replies.