Is there a way to put the commenting area on the side of a post in a sidebar? Is there a widget for this?
Hi @rob5000,
Thank you for using wpDiscuz.
You can use the wpDiscuz shortcode in this case.
You should add this code in the functions.php file of the current active theme:
function my_wpdiscuz_shortcode() {
if (file_exists(ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php')) {
ob_start();
include_once ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php';
return ob_get_clean();
}
} add_shortcode('wpdiscuz_comments', 'my_wpdiscuz_shortcode');
Then put the shortcode belowΒ wherever you want:
[wpdiscuz_comments]
You can also use shortcode in theme files add it with do_shortcode function:
<?php
echo do_shortcode("[wpdiscuz_comments]");
?>
Thanks a lot Elvina!Β Can you explain to me though how your thirds section relates to the first two parts?
Is it a different option or is it necessary after you include the first two parts?Β I want to make sure I am maximizing my ability to incorporate this because I am doing it in two different areas.Β First is on post sidebars.Β So I would use a widget for that.Β But then on a sidebar I create using Divi on a page, would I use shortcode within a text area?Β Divi's page sidebar area also lets you use the sidebar you can create with widgets as one of their options... maybe that would be easier?
oh another thing.Β This might be cooler.Β Is there any widget you can use that can make a text field overlay that I could put the short code?Β So basically a button on a page that pops up the comment area as an overlay!?
Thanks a lot Elvina!Β Can you explain to me though how your thirds section relates to the first two parts?
Is it a different option or is it necessary after you include the first two parts?
The first part is necessary, then you can use the second or third part of the code, depending on where you want to insert the shortcode:
1. If you need to use shortcode in post content use this:
[wpdiscuz_comments]
2. If you need to use shortcode in theme files, just use the do_shortcode function:
<?php echo do_shortcode("[wpdiscuz_comments]"); ?>
Is there any widget you can use that can make a text field overlay that I could put the short code?
I' really sorry but wpDiscuz doesn't have a widget to make a text field overlay. Maybe Wordpress has such a feature. You should ask this question in the WordPress forum:
function my_wpdiscuz_shortcode() {
if (file_exists(ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php')) {
ob_start();
include_once ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php';
return ob_get_clean();
}
} add_shortcode('wpdiscuz_comments', 'my_wpdiscuz_shortcode');
I added this code in the function.php for the active theme then i got the shortcodeΒ
"[wpdiscuz_comments]"
in the page i want but it showed nothing!
I tried to change the theme to twenty Nineteen and tried but still not working , Also tried to add the shortcode in the footer widget and nothing show!
Is there something i should do in the plugin setting ?
Same here Elvina.Β My code works fine when I use it in a post area.Β But when I insert code into a code module (I could use a text body area and insert code into text area over visual), it actually only works on mobile.Β Also I don't think it will be worth it to keep there regardless, if it isn't possible to exclude user pictures to give about 1/4 of the room of my sidebar more open space for the actual comment.
The shortcode works correctly. Maybe you use it the wrong way?
You should use shortcode without quotation mark(""):
[wpdiscuz_comments]
in the page i want but it showed nothing!
In case if you want show comment form on the page, you don't need shortcodes, just edit the Default form, and make sure that the comment is enabled for page.
More info here: https://wpdiscuz.com/docs/wpdiscuz-documentation/getting-started/custom-comment-form/comment-form-settings/#post-types
Note: On the page make sure " Allow comments" is enabled.
Β
Hi,
I am using the code correctly as i copy and paste itΒ
I want to show the comment box in a section at this page https://bdc-activations.com above the contact us sectionΒ
Screen shot
In your active themeΒ page.php file find comments_template() function, then put it on comment (/**/). The issue should be solved.
My code works fine when I use it in a post area.Β But when I insert code into a code module (I could use a text body area and insert code into text area over visual), it actually only works on mobile.Β
If it works on mobile, it should work on desktop too. Please make sure you enable it on desktop.Β
Also I don't think it will be worth it to keep there regardless, if it isn't possible to exclude user pictures to give about 1/4 of the room of my sidebar more open space for the actual comment.
Please navigate to Dashboard > Comments > Settings >Styling admin page, put the following CSS code in the "Custom CSS code" textarea:
#wpcomm .wc-field-avatararea .avatar{
display:none !important;
}
Don't forget to press CTRL+F5(twice) on the front-end before checking.
Β
In your active themeΒ page.php file find comments_template() function, then put it on comment (/**/). The issue should be solved.
Thanks you so much, You really so helpful π