Last active
October 17, 2021 11:56
-
-
Save EdwardBock/6528617759971ce80e12460448afa98a to your computer and use it in GitHub Desktop.
Add reading time to theme with a proxy function.
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 | |
namespace PublicFunctionOrg\Theme\ReadingTimeSample; | |
// ... | |
function reading_time($post_id){ | |
if(function_exists('reading_time_render')){ | |
reading_time_render($post_id); | |
} | |
} | |
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 | |
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