WordPress.org

Ready to get started?Download WordPress

Forums

Comments Submitted to Wrong Post (1 post)

  1. truevoyage
    Member
    Posted 1 year ago #

    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: http://www.truevoyage.com/db/thailand/koh-tao/muay-thai-boxing-training.html

    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>
    		<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>
    <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>
    		</div>
    <?php
            }

    [please remember to mark any posted code - http://codex.wordpress.org/Forum_Welcome#Posting_Code - the above codes might be broken/corrupted by the forum parser]

Topic Closed

This topic has been closed to new replies.

About this Topic