I would like to change the order in the sub-footer that appears on every post, in that I would like the share box to appear first, then comments, then previous/next article, any other related posts, then author. Can you tell me the best way to do that and ideally a way that wouldn’t get overwritten with an update? Thanks!
My site is SUindependent.com
This is part of the single template code, found in single_template_#.php and the corresponding loop-single-##.php in the Newspaper theme folder.
single_template_## loads loop-single-##, which has this block:
<?php echo $td_mod_single->get_social_sharing_bottom();?>
<?php echo $td_mod_single->get_next_prev_posts();?>
<?php echo $td_mod_single->get_author_box();?>
<?php echo $td_mod_single->get_item_scope_meta();?>
and single_template_## also has, immediately after loading single-loop-##, this:
comments_template('', true);
Swapping those various lines around would do the trick.
The two robust ways to do this update are via a child theme or via the new theme API.
The theme API is a simple plugin that adds your custom templates, modules, blocks, etc. to the theme panel. I just switched most of my modifications that were in a child theme to the theme API, since child themes come with other complications and potential slowdowns.
https://forum.tagdiv.com/the-theme-api/
In this case, you would (1) create a plugin folder, (2) find the template(s) you want to make this change in and copy both the loop-single-## and single_template_## files for those templates into your plugin folder, (3) edit them to swap the order of those elements, (4) add the code to register them in the main plugin file, and (5) upload and activate the plugin in your dashboard and switch your post templates in the theme panel.
If you wanted to do this via child theme instead, it would be less work but not quite as “robust”, at least in the opinion of some.
https://forum.tagdiv.com/the-child-theme-support-tutorial/
This time you would simply make your child theme as per that tutorial, copy the single templates in there, and edit and upload them and they would invisibly replace the ones that come with the theme.
P.S. Because that comment template code loading is in single_template_##, moving it to loop-single-## might work oddly. Or it might be fine. Haven’t tried it myself.
Hi,
Thanks @TheMediumUTM for you help!
@The Independent please follow solution provided above, as @TheMediumUTM explained very well how you can change the code. I will just add some screenshots to help you – http://screencast.com/t/o1ij5hgOjs and it is simple to do this via child theme.
Thanks!
Unfortunately attempting to fix it that way failed. The result was that the comment box actually showed up BEFORE the content text of the article.
I would think that sorting the order of those items would be something everyone would want control over and I’m actually a bit surprised it’s not part of the theme panel. Any chance it will be in an update?
And since that didn’t work do you have another proposed method? Thanks!
You switched just the comments line and the load template line. What you need to do is switch around all five lines in the two files.
Try moving the comments line into that block in the corresponding loop-single file (this is the move I was unsure about but it’s very likely fine). Then, in loop-single, rearrange the lines to get the desired order: comments, prev-next, etc. (if you’re looking at the right files, this part can’t fail).
I tried to insert the comment code into the block but it just got an error.
Again, it would seem that changing the order of these items would be something that everyone would want to do, so I’m curious if it’s something we should expect in an update. The problem clearly is that the comment should be the first thing after the end of the article text. As it is, everyone has to scroll all the way past all this other stuff to even be prompted to comment…I’m sure it’s one of the primary reasons we are getting so few comments.
Please help! Thanks!
I just tried it successfully. Your error probably comes from not inserting php tags.
Make sure that your single_template_##.php looks like this:
http://www.screencast.com/t/ddmfIhLu
And your loop-single-##.php looks like this:
http://www.screencast.com/t/n2RR6aC9c5bg
As for future updates that make this an option in the theme panel: yeah, could be nice.
Still no luck.
Here’s the error…
Parse error: syntax error, unexpected $end in /home2/independ/public_html/wp-content/themes/Newspaper/loop-single-7.php on line 43
And here are the blocks of text as they exist now…
<div class=”td-pb-span8 td-main-content <?php echo $td_sidebar_position; ?>-content” role=”main”>
<div class=”td-ss-main-content”>
<?php
locate_template(‘loop-single-7.php’, true);
?>
</div>
</div>
<div class=”td-pb-span4 td-main-sidebar” role=”complementary”>
<div class=”td-ss-main-sidebar”>
<?php get_sidebar(); ?>
</div>
</div>
<?php
break;
case ‘no_sidebar’:
?>
<div class=”td-pb-span12 td-main-content” role=”main”>
<div class=”td-ss-main-content”>
<?php
locate_template(‘loop-single-7.php’, true);
?>
</div>
<?php comments_template(“, true);?>
<?php echo $td_mod_single->get_social_sharing_bottom();?>
<?php echo $td_mod_single->get_next_prev_posts();?>
<?php echo $td_mod_single->get_author_box();?>
<?php echo $td_mod_single->get_item_scope_meta();?>
</footer>
Hi,
Please use pastebin.com and send me a copy of loop-single-7.php and single_template_7.php so I check this on my side.
Thanks!
-
This reply was modified 10 years by
Alin [tagDiv].
Hi,
The issue is here in loop content – http://screencast.com/t/w6MWYphm9 try this code for loop-single-7.php – http://pastebin.com/2fme8jKf
Thanks!
I did it all. Step by step with Newspaper-child. Nothing happens to me. Did I miss something?
http://www.pordentrodaafrica.com/
Thank you,
Benigno
Hi,
For which post template did you done this modifications? Also what child theme version do you use?
Please provide more details and also use pastebin.com and provide your custom modifications so I can check this.
Thanks!
Hi benigno,
Please provide more details what did you modify and what I asked you above(child theme version..) as I ‘m not sure what did you modify. Please read the documentation hoe the child theme works – https://forum.tagdiv.com/the-child-theme-support-tutorial/
Thanks!
Hello,
Please provide more details so I can better understand how to help./ What is not working? the get author? get_date? get_comments? do you want to move the plugin in another place? I can only guess from that screenshot. Please provide a link to your site and explicit details to what it is you want to move and where. From what I can tell that is a plugin so you will have to use the shortcode implementation for it.
Thank you!
Please hep me
I want my comments above tags on posts. I have followed instructions above but there is no changes. Here is links to codes:
Here is the Loop-single-1.php : https://pastebin.com/VSHW2yrN
single_template_1.php: https://pastebin.com/WuEvywku
Hi,
Maybe this topic will help you – https://forum.tagdiv.com/topic/how-to-put-comments-after-article/
Try it and the comments will display like you want.
Thanks