Skip to content

Instantly share code, notes, and snippets.

@EdwardBock
Last active October 17, 2021 11:56
Show Gist options
  • Save EdwardBock/6528617759971ce80e12460448afa98a to your computer and use it in GitHub Desktop.
Save EdwardBock/6528617759971ce80e12460448afa98a to your computer and use it in GitHub Desktop.
Add reading time to theme with a proxy function.
<?php
namespace PublicFunctionOrg\Theme\ReadingTimeSample;
// ...
function reading_time($post_id){
if(function_exists('reading_time_render')){
reading_time_render($post_id);
}
}
<?php
get_header();
// ... all the html page rendering
while ( have_posts() ) :
the_post();
// ... post html rendering
\PublicFunctionOrg\Theme\ReadingTimeSample\reading_time(get_the_ID());
// ... even more post html rendering
endwhile;
// ... even more html page rendering
get_sidebar();
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment