Skip Navigation

[Resolved] Integration of wpDiscuz comments system solution via shortcode works but…

This support ticket is created 8 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 4 voices.

Last updated by WeiS2074 8 years ago.

Assisted by: Shane.

Author
Posts
#380279

Hi, I have found a solution for integrating wpDiscuz comments system into views and layouts via a shortcode as described in this post on wordpres.org by the developer.

https://wordpress.org/support/topic/wpdiscuz-shortcode?replies=13

this is the code to create the shortcode

function my_wpdiscuz_shortcode() {
	if(file_exists(ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php')){
		include_once ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php';
	}
}

add_shortcode( 'wpdiscuz_comments', 'my_wpdiscuz_shortcode' ); 

I can now use this shortcode [wpdiscuz_comments] to display the comments

But the problem is although this shortcode works 100 percent and I can get it to display the discuz comments system they do not appear in the place the shortcode is integrated, they appear at the top of the page above the header that the shortcode is used on in views or layouts instead of showing where the shortcode was implemented.

can you help me with this? there was a similar problem that you guys solved with the integration of the pagenavi plugin, this was also displaying the navigation at the top of the website until you gave a fix here

https://toolset.com/forums/topic/position-of-pagination-using-wp-pagenavi/

can you take a look and maybe help me with the code needed to do the same with wpdiscuz from using the function above to create the shortcode? thx

#380330

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Stephen,

Thank you for contacting our support forum.

I suspect that this is happening because the line in the code in the file located here wp-content/plugins/wpdiscuz/templates/comment/comment-form.php is using an echo to render the form.

The reason why the echo causes this is because it is being rendered from the functions.php file and this file is loaded first when you load a new page.

What you can do is to check the comment-form.php file and see if there is an echo statement to render the form.

Also I recommend contacting the support team for the plugin in order to find the best way to render the form.

Thanks,
Shane

#380417

Hi shane,

Ty for your response, but I have since solved this problem, the easiest solution to this was a simple work around, instead of adding the shortcode into a view or layout directly the trick was to create a layout and add the shortcode to a single widget text area within that layout, it works fine for all the comments and is working great in my custom post types.

#526577

I found that this shortcode worked with the plugin after the plugin was turned on for the post type

add_shortcode( 'display_comments', 'display_comments_shortcode' );
function display_comments_shortcode() {
ob_start();
comments_template();
$res = ob_get_contents();
ob_end_clean();
return $res;
}

#1723297

Toolset custom type can display comment with wpDiscuz plugin turned on, but it loses all the style of wpDiscuz. wpDiscuz style comment only works in wp post and page. I can't find any solution.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.