comment area in sid...
 
Notifications
Clear all

comment area in sidebar?

12 Posts
3 Users
0 Reactions
3,117 Views
(@rob5000)
New Member
Joined: 5 years ago
Posts: 4
Topic starter  

Is there a way to put the commenting area on the side of a post in a sidebar? Is there a widget for this?


   
Quote
Elvina
(@elvina)
Support
Joined: 5 years ago
Posts: 1403
 

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]");
?>

   
ReplyQuote
(@rob5000)
New Member
Joined: 5 years ago
Posts: 4
Topic starter  

@elvina

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?


   
ReplyQuote
(@rob5000)
New Member
Joined: 5 years ago
Posts: 4
Topic starter  

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


   
ReplyQuote
Elvina
(@elvina)
Support
Joined: 5 years ago
Posts: 1403
 

Posted by: @rob5000

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:

https://wordpress.org/support/forums/


   
ReplyQuote
(@bassem)
Active Member
Joined: 5 years ago
Posts: 6
 
@elvina,
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 ?


   
ReplyQuote
(@rob5000)
New Member
Joined: 5 years ago
Posts: 4
Topic starter  

 @elvina @bassem

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.


   
ReplyQuote
Elvina
(@elvina)
Support
Joined: 5 years ago
Posts: 1403
 

@bassem,

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.

 


   
ReplyQuote
(@bassem)
Active Member
Joined: 5 years ago
Posts: 6
 

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


   
ReplyQuote
Elvina
(@elvina)
Support
Joined: 5 years ago
Posts: 1403
 

@bassem,

In your active theme  page.php file find comments_template() function, then put it on comment (/**/). The issue should be solved.


   
ReplyQuote
Elvina
(@elvina)
Support
Joined: 5 years ago
Posts: 1403
 
Posted by: @rob5000

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.

 


   
ReplyQuote
(@bassem)
Active Member
Joined: 5 years ago
Posts: 6
 
Posted by: @elvina

@bassem,

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 🙂


   
ReplyQuote
Share:
Scroll to top