[Resolved] Comments number in Page Header

Home Forums Support [Resolved] Comments number in Page Header

Home Forums Support Comments number in Page Header

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #374235
    Gabriele

    Hi,
    I’m using the new “Page Header” function to build my post page. I inserted post title and post date in the post header, I would like to insert the comment number, I find it very useful, but it’s not in the options. Is it possible to add it?
    Thanks a lot and greetings,
    Gabriele

    #374291
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You’d have to create a shortcode:

    add_shortcode( 'comment_number', 'tu_comment_number_sc' );
    function tu_comment_number_sc() {
        ob_start();
        comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) );
        return ob_get_clean();
    }

    Then add [comment_number] into your Page Header ๐Ÿ™‚

    #378229
    Gabriele

    Thanks Tom, it works!

    #378374
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

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