[Support request] Adding comment number and link below heading of posts

Home Forums Support [Support request] Adding comment number and link below heading of posts

Home Forums Support Adding comment number and link below heading of posts

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2432090
    Daniel

    Hi there!
    I want to add the comment number and link below post titles.
    I did this on one of my sites: https://drawpaintacademy.com/foreground-middleground-background/
    See how it has: November 9, 2022 by Dan Scott 40 Comments
    To do this, I had to add the following CSS:
    header.entry-header .comments-link:before {
    content: ” | “;
    display: inline-block;
    width: auto;
    margin: 0 5px 0 0;
    font-family: inherit;
    }
    For some reason, I added this to my other site (which is basically the same set up) but it does not work.
    Could someone take a look? Here is a page I tried adding the comments to but it did not work: https://members.drawpaintacademy.com/painting-of-the-month-still-life-kettle-2-by-nicolai-fechin/
    Thanks!

    #2432114
    Fernando
    Customer Support

    Hi Daniel,

    Yes, we can take a look. The code you added is just CSS. You’ll also need PHP to add the comment count in a single Post’s meta.

    Try adding this:

    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        $items[] = 'comments-link';
    
        return $items;
    } );
    
    add_action( 'wp', function() {
        if ( is_single() ) {
            add_filter( 'generate_show_comments', '__return_true' );
        }
    } );

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

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