[Resolved] How to display total comments below post title

Home Forums Support How to display total comments below post title

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1371070
    WP

    Hi,

    I would like to display total comments below post title(h1) and before post description(paragraph). I looked around options but could not find such option. Also, I’ve added CrowdSignal thumbs up/down widget which is not aligned properly. I’m trying to have it displayed right below post title and once displaying total comments is possible, I could like to have thumbs up/down displayed before comments similar to below.
    https://crowdsignal.com/features/

    https://pasteboard.co/JiHqB06.png

    #1371166
    Leo
    Staff
    Customer Support

    Hi there,

    Can you:

    – Disable the caching plugin first.

    – Do you only want the comment link to display in single posts but not archives?

    – As for CrowdSignal thumbs up/down widget, that’s something you will need to check with their support as the CSS is all from the plugin from what I can see.

    #1371233
    WP

    Leo,
    This site is hosted in WordPress.com. I don’t see caching plugin being activated.

    Af for comments display link – I only want the link to display in single post (including total comments).

    Let me check with CrowdSignal on resolving thumbs up/down widget position issue.

    #1371399
    Leo
    Staff
    Customer Support

    Ok this takes a couple of steps but try:

    – Activate comment count for Archives in the customizer:
    https://docs.generatepress.com/article/blog-content-layout/#archives

    – Add this PHP snippet:

    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        if ( is_single() ) {
            $items = array(
                'comments-link',
            );
        } return $items;
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Then this CSS:

    .single .comments-link {
        display: block;
    }
    footer.entry-meta .comments-link {
        display: none;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

    #1371423
    WP

    1. Activated comment count for archives
    2. Added php code on child theme
    3. added custom css

    Checked the single post, but comment counts are not showing up anywhere (both comment link and counts).

    https://pasteboard.co/JiJHgnj.png
    https://pasteboard.co/JiJHxaO.png

    #1371444
    WP

    Found why it was not displaying. Once I enabled ‘Display Post Author’ for Single on Blog Layout, comment link started showing up.

    https://pasteboard.co/JiJRyTR.png

    Two more question:
    1. How can I move comments similar to below
    2. Display #of post views stats similar to below

    https://pasteboard.co/JiJTKAP.png

    #1371519
    Leo
    Staff
    Customer Support

    1. How are you adding the thumb up/down currently?

    You would need to add it using the after_entry_header hook with a hook element in order to reposition them:
    https://docs.generatepress.com/article/hooks-element-overview/

    2. You’d need a post view counter plugin.

    #1374125
    WP

    Leo,
    Thumb up/down are being displayed using CrowdSignal plugin. I have ticket open with their support to see if after_entry_header hook could be utilized.

    Regarding displaying comment link below title (in post meta), I wanted to replace ‘Leave a Comment’ with ‘Add Comment’ with below code, but it not replacing the text.

    add_filter( 'generate_leave_comment','st_custom_leave_comment' );
    function st_custom_leave_comment() {
        return 'Add Commment';
    }
    
    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        if ( is_single() ) {
            $items = array(
                'comments-link',
            );
        } return $items;
    } );
    
    #1374193
    WP

    Ok – this worked. It seems that WordPress.com business plan uses custom comment form.

    add_filter( 'gettext', function( $text, $original, $domain ) {
        if ( 'Leave a comment' === $text && 'generatepress' === $domain ) {
            return 'Add Commment';
        }
    
        return $text;
    }, 10, 3 );
    #1374274
    Leo
    Staff
    Customer Support

    Glad you’ve figured out and thanks for sharing!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.