[Resolved] Show Reading Time on Post Only

Home Forums Support [Resolved] Show Reading Time on Post Only

Home Forums Support Show Reading Time on Post Only

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1634022
    Danar Virdaus

    Hello,

    I use this code to show estimated reading time:

    https://generatepress.com/forums/topic/creating-an-estimated-reading-time/page/2/#post-647138

    How to show estimated reading time only on single posts? With that codes, it showed on both single posts and archives.

    thank you in advance πŸ™‚

    #1634105
    Natalie

    You could try this

    add_filter( 'generate_post_date_output', function( $output ) {
        if(is_single() {
         $output .= '<div class="read-time">Reading time: ' . tu_estimated_reading_time() . '</div>';
        }
    
        return $output;
    } );
    #1634117
    Danar Virdaus

    syntax error, unexpected ‘;’ πŸ˜€

    #1634124
    Natalie

    Sorry – I missed a closing bracket

    add_filter( 'generate_post_date_output', function( $output ) {
        if(is_single()) {
         $output .= '<div class="read-time">Reading time: ' . tu_estimated_reading_time() . '</div>';
        }
    
        return $output;
    } );
    #1634128
    Danar Virdaus

    Ahh It Works! πŸ™‚
    Thank You Natalie πŸ˜‰

    #1634379
    David
    Staff
    Customer Support

    Thanks Natalie πŸ™‚

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