- This topic has 9 replies, 3 voices, and was last updated 5 years, 10 months ago by
Tom.
-
AuthorPosts
-
May 7, 2020 at 9:31 am #1274057
Carson
How would I move the comments to a different area, for example in the before_footer area as the last element (In case you have several elements in that area). Thank for any help!
May 7, 2020 at 3:12 pm #1274565Tom
Lead DeveloperLead DeveloperHi there,
As of right now, you’d need to overwrite the
single.phptemplate in your child theme and remove this code: https://github.com/tomusborne/generatepress/blob/2.4.2/single.php#L28-L43Then you’d need to add that code into a hook to add it to your desired area.
We’ll be making this hook-able by default in the future 🙂
May 8, 2020 at 4:16 am #1275099Carson
That sounds easy, this is the code I delete and place in an element?
// If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || '0' != get_comments_number() ) : /** * generate_before_comments_container hook. * * @since 2.1 */ do_action( 'generate_before_comments_container' ); ?> <div class="comments-area"> <?php comments_template(); ?> </div> <?php endif;May 8, 2020 at 5:57 am #1275202David
StaffCustomer SupportHi there,
thats correct.
May 8, 2020 at 8:15 am #1275502Carson
This doesn’t work and also my footer is gone now.
I create a new single.php in the child theme folder, then copy the entire code Tom linked into it. Then I cut the line 28-43 out and place it in an element, correct?
May 8, 2020 at 4:02 pm #1276033Tom
Lead DeveloperLead DeveloperYes, you would copy the
single.phpfile from the parent theme and add it to your child theme.Now in that child theme file, you need to remove the block of code I highlighted above.
All that should do is remove the comments from your single posts.
May 9, 2020 at 11:21 am #1277073Carson
Yes, that removes the comment section. However I can’t just copy paste that code in an element to make comments show somewhere else. What do I have to paste in the element?
May 9, 2020 at 5:01 pm #1277317Tom
Lead DeveloperLead DeveloperThis would go into a Hook Element:
<?php if ( comments_open() || '0' != get_comments_number() ) : do_action( 'generate_before_comments_container' ); ?> <div class="comments-area"> <?php comments_template(); ?> </div> <?php endif; ?>May 12, 2020 at 4:14 pm #1281708Carson
This works perfectly, not sure what I did wrong earlier. Thank you!
May 13, 2020 at 8:58 am #1282760Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.