Archived topic
Show Reading time on WP Show Posts (home page)
4 replies · Started by Charbel on November 1, 2021
Hello @David and @Leo,
I am using an Element to display the estimate reading time on every article (post).
Here is PHP code from the Element (generate_after_entry_title):
<?php
function custom_estimated_reading_time() {
global $post;
$content = $post->post_content;
$wpm = 300; // How many words per minute.
$clean_content = strip_shortcodes( $content );
$clean_content = strip_tags( $clean_content );
$word_count = str_word_count( $clean_content );
$time = ceil( $word_count / $wpm );
return $time . ' Min. ';
}
?>
<div class="read-time"><?php echo custom_estimated_reading_time() ; ?>Read</div>
How can I use the same Element to display it on WP Show Posts next to the Author name (right side)?
The author name is on the left, I need to add the estimate reading time on the right-hand side.
Your help is highly appreciated.
Article: https://charbelnemnom.com/passing-the-azure-security-center-ninja-training/
Many Thanks!
-Charbel
Hi Charbel,
Please open a support topic in WPSP's support forum here as the question is a WPSP specific question:
https://wordpress.org/support/plugin/wp-show-posts/
Thank you!
Thank you @Leo, I will do.
I have opened here under the Pro version:
https://wpshowposts.com/support/topic/show-reading-time-on-wp-show-posts-home-page/#post-35157
Even better.
Elvin will get to it later.
Thanks!
Super, many thanks!