Okay
  Public Ticket #3742032
Incorrect read time shown in front end
Closed

Comments

  • Gergana started the conversation

    Hi there, 

    I'm having a problem with the read time shown on the front end of my blog posts. On the front end it's showing an excessive reading time (like 22 minutes for a 1500-word post), though on the back end, the reading time looks much more reasonable (e.g. 9 minutes). 

    I figured the problem is the global elements I use throughout the text, and especially one of them (a sign up form by MailerLite) contains an extremely long HTML code. So the reading time includes those elements, though it seems only on the front end.  

    In posts, where the sign up form is not present, reading time looks fine (e.g. https://petme.es/perfiles-integrados-mascotas/). 

    Is there a way to exclude the global elements from the reading time? 

    On an unrelated subject, for the share element on blog posts, it gives you the option to share to Facebook, X, Pinterest and LinkedIn. Is it possible to add a copy link and email? 

    Thanks in advance. 

    Attached files:  Backend.png
      Frontend.png

  •  3,001
    Andrew replied

    Hi Gergana,

    Thank you for reaching out to us.

    As this seems like a plugin check, please check for plugin conflicts by deactivating the third-party plugins then reactivate it back one by one to see the one that causes issues. 

    Try this and let us know how it goes.

    Kind regards,

  •  8,938
    Tahir replied

    Hey Again,

    Thanks for reaching out! .

    You will have to edit the Reading Time function as below, add the below code to the Child Theme "functions.php" file or via a Code Snippet Plugin: 

      function nectar_estimated_reading_time( $content = '' ) {
    
        // Strip [nectar_global_section] shortcode with any id
        $content = preg_replace('/\[nectar_global_section.*?\]/', '', $content);
        
        // Strip HTML tags and process shortcodes
        $text_only = strip_tags( do_shortcode( $content ) );
    
        // Get word count
        $word_count = str_word_count( $text_only );
    
        // Calculate time based on 180 words per minute
        $time = max(ceil( $word_count / 180 ), 1);
    
        return $time;
      }
    
    

     

    Let me know if this helps! Happy to assist further if needed.

    Best,

     


    ThemeNectar Support Team 

  • Gergana replied

    Thanks, it worked with a small adjustment, as it was giving me an error initially but I managed to make it work. 

    What about my second question? For the share element on blog posts, it gives you the option to share to Facebook, X, Pinterest and LinkedIn. Is it possible to add a copy link and email? 

    Thanks again

  •  8,938
    Tahir replied

    Hey Again,

    Glad you got it working.

    I am afraid you will have to use a Third Party Plugin that offers such copy and email features and turn off the Salient Sharing feature.

     

    Best,

     


    ThemeNectar Support Team