Where to place this bit of code for reading time?

Posted in: Newspaper
Post count: 19

Hi,

i have this small peace of code and want it to be shown before the content in every post. in which php-File do i have to place it exactly where? (we will initiate a child theme)


<?php $mycontent=$post->post_content;$word=str_word_count(strip_tags($mycontent));$m=floor($word/200);$s=floor($word%200/(200/60));$est=$m.' Minuten'.', '.$s.' Sekunden';?>
<p style="font-size:8pt;">Geschätzte Lesezeit: <?php echo $est;?></p>

Regards,
Roger

Post count: 20688

Hi,

The php files for the default post templates are these ones
https://www.screencast.com/t/dwdWxjoqN9
Opening one of them the structure of the template can be seen. Enter that code in the desired location and it should appear in posts using the respective post template. Make the modification to the post templates that you use.

The post template files can be modified in a child theme
https://forum.tagdiv.com/the-child-theme-support-tutorial/

Thanks

Post count: 19

Thanks, Simion – worked instantly

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.