0

I'm modifying some existing code and trying to add the ability for user to leave comments on single post and then echo those comments based on approval. I need to add right below <?php the_content(); ?> What is the code I need to add below this to get comments?

1
  • add this if ( comments_open() || get_comments_number() ) {comments_template();} Commented Jul 17, 2014 at 16:06

2 Answers 2

0

Right bellow the content (single post)

<?php if (function_exists('paged_comments_template')) paged_comments_template(); else comments_template(); ?>

And the approval you need change in the wordpress panel.

0

In the content.php, add code like this:

if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
        ?>
        <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', '$text_domain' ), __( '1 Comment', '$text_domain' ), __( '% Comments', '$text_domain' ) ); ?></span>
        <?php
            endif;

And before endwhile in single.php, this:

if ( comments_open() || get_comments_number() ) {
                        comments_template();
                    }
                endwhile;
            ?>

View the single.php and content.php files in the Twenty Fourteen theme for a guide.

Moderate comments using the Discussion settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.