wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

[Solved] wpDiscuz 7 shortcode [wpdiscuz comments]  


a01new
Posts: 1
(@a01new)
New Member
Joined: 6 months ago

Hello

I have a problem with the new update version 7

I used this code [wpdiscuz_comments] but with this update it no longer works

10 Replies
Taron
Posts: 36
Support
(@taron)
Support Team
Joined: 1 year ago

Hi @a01new.

Please use this code instead of the old one.


function my_wpdiscuz_shortcode() {

$html = "";
if (file_exists(ABSPATH . "wp-content/plugins/wpdiscuz/themes/default/comment-form.php")) {
ob_start();
include_once ABSPATH . "wp-content/plugins/wpdiscuz/themes/default/comment-form.php";
$html = ob_get_clean();
}
return $html;
}
add_shortcode("wpdiscuz_comments", "my_wpdiscuz_shortcode");
5 Replies
starapple
(@starapple)
Joined: 5 months ago

New Member
Posts: 3

@taron, I'd like to suggest that this function be put into the plugin rather than be something to be added to functions.php. When a site owner/admin changes a theme, this has to be done all over in the new functions file.

In my case, I'm using Elementor to create some posts that benefit from special layout; but Elementod does not add an option to include a comment form--at least not in the free version. Using a plugin or a widget element is the only way to include a comment form on a single post created using Elementor--and probably other block design plugins.

This shortcode gives content creators a nice way to create single posts with a comment form.

All the best.

Asti
 Asti
Support
(@asti)
Joined: 3 years ago

Support member
Posts: 1669

Thank you for suggestion @starapple

This is just a workaround in cases if the shortcode is required. We'll need to make a lot of changes in the plugin codes to add this in the plugin codes. However, we'll take into consideration for future updates.

starapple
(@starapple)
Joined: 5 months ago

New Member
Posts: 3

@asti, I'm familiar enough with WordPress plugins to know that all it take is pasting the above code at the correct place. In fact, the only reason I use it in the theme's functions file and not in the plugin, is that when you send out new updates I'd lose the function. I successfully tested it in the plugin myself but decided against that approach.

trebuag
(@trebuag)
Joined: 3 weeks ago

New Member
Posts: 4

@taron

Hi Taron,

I'm working on a elearning wp website. the lecon pages don't have the "add comments" option by default. I've copied your code and wpdiscuz works well on every pages wp comment would have worked but not under my lecon pages where I have my videos and textes to comment.

the lecon pages are managed with membership and roles

(I'm using elementor edit in case it's change anything)

any sugestion ?

Asti
 Asti
Support
(@asti)
Joined: 3 years ago

Support member
Posts: 1669

@trebuag,

Please follow this support topic: https://wpdiscuz.com/community/postid/5507/

Lisa Ramish
Posts: 5
(@lisa-ramish)
Active Member
Joined: 5 months ago

I pasted that code in my functions.php and the shortcode works in the body of a lesson now (in fact, it appears twice). But I can't get it to work in my sidebar even though I can get other shortcodes to work using a text widget. Here's a sample page:  http://kippdcmath.com/.../overview-of-kipp-dc-math-10-min/

3 Replies
Asti
 Asti
Support
(@asti)
Joined: 3 years ago

Support member
Posts: 1669

@lisa-ramish,

Please follow this support topic: https://wpdiscuz.com/community/troubleshooting/embed-comment-section-in-a-sidebar/#post-2714

starapple
(@starapple)
Joined: 5 months ago

New Member
Posts: 3

@lisa-ramish, is this a genuine support post? Why am I redirected to Facebook from that link in your post?

Lisa Ramish
(@lisa-ramish)
Joined: 5 months ago

Active Member
Posts: 5

@starapple I'm sorry! I posted for help on a facebook forum that I am a part of and just copied this from there. This is the link without facebook messing with it: http://kippdcmath.com/lessons/overview-of-kipp-dc-math-10-min/

I saw Asti's link to add a shortcode widget but other shortcodes are working in my sidebar so I don't see why that's necessary.

Share: