How to Put Comment Count on Front Page
  • jdgreenjdgreen July 2011

    I tried to follow the instructions in this post (http://themes.bavotasan.com/support/discussion/53) to get a comment count on the front page of Magazine Basic but I can't find the files referenced. I'm thinking those instructions were for an older version.

    In any case, can someone please instruct me on how to get a comment count on the posts on the front page of the current version of Magazine Basic?

    Thanks in advance,
    JD Green
    (using Magazine Basic but purchased Magazine Premium last year)

  • jdgreenjdgreen July 2011

    Hello,

    Is anyone answering forum questions? I really need help with this. Assistance is greatly appreciated.

    Thanks,
    JD Green
    (using Magazine Basic but purchased Magazine Premium last year, can provide documentation if necessary)

  • insert "<?php comments_number('','1 Comment','% Comments'); ?>" after the code "the_author_posts_link" in the layout section (since I am using an older version of MB, I did this change in 'option1.php' layout file.

  • cbavotacbavota July 2011

    You now need to edit the loop.php file.

    133
    134
    135
    136
    137
    138
    139
    140
    141
    echo '<div class="meta">';
    if(is_home()) {
    if(theme_option('dates_index') == 'on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
    if(theme_option('authors_index') == 'on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
    } else {
    if(theme_option('dates_cats') == 'on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
    if(theme_option('authors_cats') == 'on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
    }
    echo '</div>';


  • jdgreenjdgreen August 2011

    Okay, I've located the code you reference above.

    I'd like to put the comment count after the excerpt, not in the meta info.

    Do I use this code below?

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

    If so, can you please tell me where to put it?

    Thanks :)

  • cbavotacbavota August 2011

    Put it after line 191:

    191
    192
    theme_excerpt($wordlimit);
    comments_number('','1 Comment','% Comments');


  • jdgreenjdgreen August 2011

    I think I need this to show outside the excerpt because I can't seem to style it within the excerpt. Can you tell me how to put it above the read more button?

    Thank you and sorry for all the questions. Still getting the hang of working with the loop!

  • cbavotacbavota August 2011

    You can style it if you surround it with a div container.

    echo '<div class="comment-count">'.comments_number('','1 Comment','% Comments').'</div>';

  • jdgreenjdgreen August 2011

    I tried that before and it didn't work. I tried it again using the code you provided and it's still not working. It wants to use the styles from the excerpt.

    Here is what I'm using:

    }*/
    theme_excerpt($wordlimit);
    echo '<div class="comment-count">'.comments_popup_link('','1 Comment','% Comments').'</div>';
     
    } else {


    Do you see anything wrong?

    Thanks!

  • cbavotacbavota August 2011

    Try this:

    echo '<div class="comment-count">';
    comments_number('','1 Comment','% Comments');
    echo '</div>';

  • nnagarajan7nnagarajan7 February 22

    Hi cbavota,

    Greetings!!

    I have managed to display comment count in the front page by adding the relevant code i.e. comments_number('','1 Comment','% Comments'); in the loop.php at the layout section (MB 2.7.7). But it is very close to the author and I need to add a bar (|) or a space before the comment count.

    I also need to link this to the comment section. Is this possible?

    Your guidance will be much appreciated.

  • cbavotacbavota February 23

    Use the comments_popup_link() instead of the comments_number() to make it link to the post comment section. You can add HTML before the function, outside of the PHP tags in order to space it however you want.

Hey there!

Take a look around, and if you would like to add a comment or start a discussion, register by clicking on the button below.

Register

Categories

In this Discussion

Tagged