Last active
October 17, 2021 11:36
-
-
Save EdwardBock/44b460560cc1dbbf4901584002e88bea to your computer and use it in GitHub Desktop.
Add reading time to post content with the_content filter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter("the_content", function($content, $post){ | |
if ( is_singular() && in_the_loop() && is_main_query() ) { | |
// https://gist.github.com/EdwardBock/fa659b67bcf4f568289d0c49c175f42b | |
$add = reading_time_get_content($post->ID); | |
return $add.$content; | |
} | |
return $content; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment