- This topic has 11 replies, 3 voices, and was last updated 3 years, 6 months ago by Leo.
-
AuthorPosts
-
September 29, 2020 at 10:28 am #1464194Jatin
Hi Guys,
can you please advise how can i fix the comment box to a proper layout on a single post.Questions: 1) Can i move the comment box to my End of the Post after Categories
2) if not how to adjust the left and right gaps as shown in the screenshot for the comment box. Thanks.September 29, 2020 at 10:47 am #1464229LeoStaffCustomer SupportHi there,
Looks like you are using Comments – wpDiscuz so the question should be answered by their support.
Here are some CSS to help to get you started:
#comments { max-width: unset; margin: 0; padding: 0; } #wpdcom { margin-left: 0; }
You can change the second
unset
to like1000px
to adjust the width.September 30, 2020 at 1:00 am #1464819JatinThanks Leo. It works but there are Three questions on this:
> The comment form is stretched, i wanted the same width but left aligned.
> There is a gap from the in the container on top of the comment box. https://imgur.com/T5nPual
> Is it possible to move it in the same container as my post.September 30, 2020 at 12:21 pm #1465886LeoStaffCustomer SupportLet’s try moving it first. I’m not sure if it will work as you are using a plugin but worth a shot.
– Create a hook element:
https://docs.generatepress.com/article/hooks-element-overview/– Add this as the content:
<?php 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; ?>
Then choose the
generate_after_content
hook and check to execute PHP.Set the display rules to post > all posts.
Let me know if this works or not. I tested and it works with the default comment form without a plugin.
September 30, 2020 at 3:51 pm #1466175JatinYes it does work but shows two comment boxes now. Please check the link which i sent in the private info box.
September 30, 2020 at 4:00 pm #1466182LeoStaffCustomer SupportNow add this to remove the default position:
add_action( 'wp', function() { remove_action( 'generate_after_do_template_part', 'generate_do_comments_template', 15 ); } );
Adding PHP: https://docs.generatepress.com/article/adding-php/
October 1, 2020 at 12:47 am #1466597JatinThanks Leo, it worked perfectly file as needed. Only one concern here, I added your code in functions.php file and its not a child theme. So if i update my theme i might lose the changes what should i do here ?
October 1, 2020 at 4:11 am #1466892DavidStaffCustomer SupportHi there,
any code you add directly to the Parent Theme will be lost when the theme updates.
You should use a Child Theme or add the code using the Code Snippets plugin:October 1, 2020 at 5:57 am #1467042JatinThanks David,
Can I use Pluginception to create plugins and use that way or code snippets is better ? If pluginception is better then do I have to create a separate plugin for each piece of code or all of my code can go in one plugin.
I have code snippets installed and when I add a code there is an option to run the code everywhere. How can I restrict it to run only for single posts.
October 1, 2020 at 8:51 am #1467559LeoStaffCustomer SupportCode Snippets is better and easier.
How can I restrict it to run only for single posts.
I don’t think the plugin offers this option.
October 1, 2020 at 9:29 am #1467634JatinThanks Leo
October 1, 2020 at 9:35 am #1467656LeoStaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.