• Hello,

    I’d like to add a “Number of Comments” link to the archives page.

    I’m guessing I need to do that in index.php in my child theme.

    Just wondering what code to add and where to add it.

    Is this a feature you’d like to include in an update?

    Thanks. I adore this theme,

    Elizabeth

    https://500confessions.com/blog/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Shaped Pixels

    (@shaped-pixels)

    After reading your post, I realized that this was something I was planning to add to a previous version. However, it looks as though I neglected to add that in. I now remember someone else a couple months back wanting this in because they did not use a “Read More” on posts.

    I’m also assuming you are referring to the blog home page that displays post intros (summaries)? If so, this is what this update will relate to.

    I will include this in the next update, but that might be a while. However, you do not have to wait as I will show you how to make this change now. Normally editing a theme file should not be done but because this will be in the next update, it’s OK to make this change.

    Open the template-tags.php file (found in the “inc” folder) and look for this line 115:

    if( esc_attr(get_theme_mod( 'show_edit', 1 ) ) ) {

    Just above that, copy and paste this code into it:

    if ( ! is_single() && ! post_password_required() && ( comments_open() ||   get_comments_number() ) ) {
    if (esc_attr(get_theme_mod( 'show_comment_count', 1 ))) :
    echo '<span class="comments-link post-meta">';
    /* translators: %s: post title */
    comments_popup_link( sprintf( esc_html__( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'seasonal' ), get_the_title() ) );
    echo '</span>';
    endif;
    }

    IMPORTANT: Make sure you make a copy backup of this file before you edit the file in case you had to revert back to it.

    Thread Starter Elizabeth Richardson

    (@lifegames)

    That’s great thanks.

    I found the right place.

    That code works when there ARE actual comments, but when there aren’t, it shows –

    Leave a comment<span class=”screen-reader-text”> on THE TITLE OF MY POST</span>

    Theme Author Shaped Pixels

    (@shaped-pixels)

    ah…I see my mistake.
    Remove the esc_html part.

    Thread Starter Elizabeth Richardson

    (@lifegames)

    Thanks Andre,

    It’s all sorted now.

    All the best,

    Elizabeth

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding a Number Of Comments link’ is closed to new replies.