Time to Read plugin – Adding shortcode to Theme files

Posted in: Newspaper
Post count: 11

I installed the ‘Time to Read’ plugin and it has the ability to be displayed on all posts as part of the meta-information, the advice on how to do this is given below:

“In case you want to display the time to read feature along with other meta information like author name, category, and date, you have to edit your theme files and place the following code:

<?php echo do_shortcode(‘[rt_reading_time label=”Reading Time:” postfix=”minutes”]’); ?> ”

I’m not entirely sure which theme file that code would have to be added to, to achieve this though.

Post count: 35449

Hi,

The code need to be set on the files that are using as post templates for your posts, also please notice that all the changes made in them files will be lost when you’ll make a theme update.
If you are using a standard post style from 1 to 13 -> https://i.imgur.com/QQiXTjF.png the code need to be set in these files loop-single-x.php (x represent the number of post style) -> wp-content/plugins/td-standard-pack/Newspaper/parts/single/loop-single-1.php -> https://i.imgur.com/SjuUy38.png the code can be set there, also it need to be set on the post style you are using. If you are using the default post style and tagDiv Standard pack is enable https://i.imgur.com/YHYP2o5.png the file that need to be edited is this one -> wp-content/plugins/td-standard-pack/Newspaper/loop-single.php if this theme plugin is disable, then you need to edit for default post style this file -> wp-content/plugins/td-composer/legacy/Newspaper/loop-single.php
The above changes can be set in a child theme using our guide from here -> https://forum.tagdiv.com/the-child-theme-support-tutorial/
If you are using a single post template from tagDiv Cloud Library, then you need to set the code in one of the files from here -> wp-content/plugins/td-cloud-library/shortcodes/single for example in tdb_single_author.php -> https://i.imgur.com/iYm4uEd.png also the code that is provide to you need to be adjusted (these changes can not be set in a child theme).

Hope this will help you!
Thank you!

Post count: 19

Hi Calin,

I’m having an issue similar to the one you address. After updating to Newspaper 10, my customizations to the loop-single-x.php files were overwritten. I was able to get my customizations back by uploading my customized loop-single-x.php files to wp-content/plugins/td-standard-pack/Newspaper/parts/single/, but this is not a best practice.

Best practice, of course, is to upload to a child theme as you indicate. Where exactly in the child theme should I upload the loop-single-x.php files?

Thanks!

  • This reply was modified 6 years by bxp331.
  • This reply was modified 6 years by bxp331.
  • This reply was modified 6 years by bxp331.
  • This reply was modified 6 years by bxp331.
Post count: 35449

Hi,

Inside the child theme you need to set two sub-folders -> parts/single -> https://forum.tagdiv.com/the-child-theme-support-tutorial/

Thank you!

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