Hi
I Need to add code at the end of Posts and pages. Which files do I have to Change for the child-theme?
Cheers
from Germany
Hansjörg
-
This topic was modified 8 years by
Hansjörg Leichsenring.
Hi,
Each post template has a corresponding loop single file (Ex: post template 2->loop-single-2.php) These files are located in the main theme folder
– https://www.screencast.com/t/mhczc6hKSq4t
Editing one of the post template files you can see the post structure, enter the code where you want.
The page templates as well are found in the main theme folder, edit them as you wish
– https://www.screencast.com/t/N7w6qnK3r
Copy the files in the child theme and customize them. This is a child theme tutorial
– https://forum.tagdiv.com/the-child-theme-support-tutorial/
Thanks
Hi Simion
thanks. Would it be easier (and possible) to put code in the “end of a post or page”? E.g. above previous/next article?
Is there an “one for all” file? At least for Posts?
Cheers
Hansjörg
Hi,
There is a file where all the post functions are defined
– https://www.screencast.com/t/E8eShodD
These functions are then called in each post template. But I believe the cleanest way to do what you want is to enter the code in the loop single files, in the position you want.
These files can be customized through a child theme as well, there is no problem there.
Thanks
Hi Simion
you mean loog-sinlge.php? Where in there is the best place to Show something at the end of a post?
Cheers
Hansjörg
Hi,
As I mentioned each post template has a corresponding loop-single file. Enter the code in the loop-single file for the post templates you are using. The file you mention, loop-single.php corresponds to the default post template
– https://www.screencast.com/t/xRYzX7gtjd
Modifications to this particular file will affect only posts using the default post template. If you use other post templates on other posts, you will have to enter the code in their corresponding loop-single files as well. That would be the best way to do this.
Thanks
Hi
After some time I want to update the theme. I am just realizing, that there seems to be no more various loop-single files but just one, which is much better.
The question now is: In which file do I have to add additional code, which should appear just after a post and before the previous(next article?
Thanks in advance
Cheers
Hansjörg
Hi,
That is correct, there were changes to most of the theme file location after update 9.7, they are now in the tagDiv composer plugin. There is an article about it here
– https://tagdiv.com/updating-the-core-of-tagdiv-themes/
So now the loop files are here – http://prntscr.com/nqu4yj and only the default post template file remained in the theme – http://prntscr.com/nqu6ke
The ones from the plugin can’t be modified in a child theme same as before, the child theme is now quite limited and only a few files can still be modified in it. So they would have to be modified directly.
What kind of code were you using? maybe there is a different way of doing it.
Thanks
Hi Simion
thanks. This is the code, I added before in the different loop-single files to appear right after the content:
<?php echo $td_mod_single->get_content();?>
</div>
<div class="artikelende">
<?php echo adrotate_group(3); ?>
<h3>Ihnen hat der Beitrag gefallen? Dann bitte ...</h3>
<?php {if(function_exists('the_ratings')) { the_ratings(); } ;} ?>
<?=do_shortcode('[shariff align="center"]')?>
</div>
<footer>
What would be the best place now?
Cheers
Hansjörg
Hi,
The loop files are now in the composer plugin, as in the screenshot from above. You could edit the ones you want and enter the code there, but I should note that when the theme and plugins are updated the code would have to be entered again.
An exception is the default post template which remained in the theme and can still be edited in a child theme
– http://prntscr.com/nr8qm4
Instead of this maybe try using a cloud post template. Enter the plugin shortcode directly in the template while editing with the composer.
If you use the ratings plugin try t like here – https://forum.tagdiv.com/topic/how-to-edit-post-template-in-version-9-7-1/