• Hi everyone,

    I recently created a blog with WordPress (http://necpluribusimpar.net) and I need some help. I’m using the Retina theme, which I like a lot, but it doesn’t have a comments count on the front page and I would like to have one. Can someone tell me how I can add one, so that when someone goes on the front page of my blog, he can see the number of comments on each post as is the case on most blogs? Thanks in advance for your help!

    Best,
    Philippe

Viewing 5 replies - 1 through 5 (of 5 total)
  • Something like this.

    <?php comments_number( '0 Comments', '1 Comment', '% Comments' ); ?>

    https://codex.ww.wp.xz.cn/Function_Reference/comments_number

    • This reply was modified 9 years, 4 months ago by Patrick.
    Thread Starter phl43

    (@phl43)

    Thanks! I did find that function on WordPress’s website, but I’m wondering where to put this code to modify the Retina theme I’m using in a clean way.

    In your theme files.

    index.php – if you want it on the home page
    single.php – if you want it on the single post page

    Creating a child theme would be better.
    https://codex.ww.wp.xz.cn/Child_Themes

    They both might be using a different template file to display the loop so it really depends on the theme. You can ask the Retina theme support about this.

    https://ww.wp.xz.cn/support/theme/retina

    • This reply was modified 9 years, 4 months ago by Patrick.
    Thread Starter phl43

    (@phl43)

    Thanks a lot! I had a look at the code of the theme and it seems like I just need to put the code you gave me above in the files named content.php and content-single.php. (I guess that’s just how the guys who create the Retina theme named index.php and single.php.)

    But am I correct that this will only display the number of comments for each post, not add a link so that the user is taken to the comments by clicking on the number? If so, how do I add a link in a clean fashion (I don’t want it to be a hack), so that one goes to the comments when one clicks on the number?

    Too add a link to the post’s comments, use comments_link()

    https://codex.ww.wp.xz.cn/Function_Reference/comments_link

    • This reply was modified 9 years, 4 months ago by Patrick.
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding a comments count to my posts’ is closed to new replies.