1

I am learning how to create custom Wordpress theme from this page
and everything is working except commenting system because they haven't described how to enable it (they only used <?php comment_form(); ?> to insert form into template). I can see my comment in the backend but not in the page itself (I can see a link showing 1 comment but when I click it nothing happens). Obviously I need some PHP code to show my comments but have no idea where to start! I am stuck because I just started to learn Theme Development and my PHP knowledge is limited.
Can anyone give me a suggestion or a solution for that problem? It would a mean a lot to me. Index php looks like this:

<?php get_header(); ?>

<div id="blog">
    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

    <div class="post">
    <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

        <div class="entry"> 
            <?php the_post_thumbnail(); ?>
            <?php the_content(); ?>

            <p class="postmetadata">
            <?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />
            <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>
            </p>

        </div>
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <?php posts_nav_link(); ?>
    </div>

    <?php endif; ?>
</div>


My Wordpress page HERE
Thank You!!

5
  • There's a syntax error when trying to view comments: Parse error: syntax error, unexpected T_ENDWHILE in /home/robertpe/public_html/wordpress_template/wp-content/themes/New 3.0 Theme/single.php on line 28 Commented Nov 18, 2012 at 14:45
  • I Know trying to make it work. Try look now.
    – Dejo Dekic
    Commented Nov 18, 2012 at 14:48
  • Add in comments_template(); before your endwhile;. Commented Nov 18, 2012 at 14:52
  • Now I have two comments fields but my comments still doesn't show...
    – Dejo Dekic
    Commented Nov 18, 2012 at 15:00
  • 1
    @stealthyninja as an answer please.
    – Rarst
    Commented Nov 18, 2012 at 15:09

1 Answer 1

2

Edit your comments.php template and add in

<ol class="commentlist">
    <?php wp_list_comments(); ?>
</ol>

This should display comments, pingbacks and trackbacks. See the Codex for wp_list_comments() for help on how to style and separate or to display just comments.

1
  • 1
    I will say just this: stealthyninja THANK YOU for your effort and your time it worked like a charm you have just made my day beautiful!!!
    – Dejo Dekic
    Commented Nov 18, 2012 at 15:23

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.