Enhance post cards with date, reading time, and comment count metadata

This commit is contained in:
Adolfo Reyna
2026-03-12 23:35:34 -04:00
parent d4d53ca56b
commit 63fafb4489
3 changed files with 41 additions and 2 deletions

View File

@@ -39,6 +39,17 @@ function wisdom1_scripts() {
}
add_action( 'wp_enqueue_scripts', 'wisdom1_scripts' );
/**
* Calculate estimated reading time.
*/
function wisdom1_reading_time() {
$content = get_post_field( 'post_content', get_the_ID() );
$word_count = str_word_count( strip_tags( $content ) );
$reading_time = ceil( $word_count / 200 ); // Average 200 words per minute
return $reading_time . ' min read';
}
/**
* Customizer additions.
*/