Site logo

Archived topic

Comment Box Adjustment on Single Post

11 replies · Started by Jatin on September 29, 2020

Viewing posts 1–12 of 12

Hi Guys,
can you please advise how can i fix the comment box to a proper layout on a single post.

https://imgur.com/WWo6ZlS

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.

Hi 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 like 1000px to adjust the width.

Thanks 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.

Let'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.

Yes it does work but shows two comment boxes now. Please check the link which i sent in the private info box.

Thanks 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 ?

Thanks 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.

Code 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.

Thanks Leo

No problem :)

This archived topic is closed to new replies.