wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

[Solved] wpDiscuz shortcode


Asti
 Asti
(@asti)
Support member Support
Joined: 4 years ago
Posts: 3901
Topic starter  

wpDiscuz allows you to load the comment section via [wpdiscuz_comments] shortcode as well.

To start using  the wpDiscuz shortcode, just put the following code in the active theme functions.php file:

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

Here is an instruction on how to easily add custom code in WordPress (without Breaking Your Site): https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

Then, you can use the shortcode in the post/page content wherever you want. 

Besides adding the shortcode, you'd also need to enable the comment form for the current post type

That is: the shortcode can be used if the post type supports comments.  

In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.


Share: