Using Wordpress Comments *alongside* Discourse

It seems that once you ‘publish to Discourse,’ the Wordpress comment submit box disappears, even if you’ve unchecked use Ajax and you’ve opted not to remove Wordpress comments. Is it possible to allow visitors to leave Wordpress comments alongside the Discourse-linked discussion?

I’m going for

Hello @Kayla. Is your Wordpress theme a block theme or a “classic” theme?

The recommended way of doing this is using a block theme. That way you have complete control over which comment blocks you put where and don’t have to worry about which template is overriding which. For example this comment block configuration (Wordpress comments followed by Discourse comments) on Wordpress’ current default theme (Twenty Twenty Four)

Results in this

https://wp-discourse.pavilion.tech/a-post-with-both-types-of-comments/

1 Like

Nice! Love that you put up a demo and everything, that’s awesome. :heart:

Unfortunately the site in question is using a ‘classic’ Genesis Framework theme, and further unfortunately, it is also making liberal use of Toolset archive templates, which cannot yet be replicated in a Site Editor/FSE theme.

I did some more playing around, and it seems to show both the Discourse replies (first) and WP comments (including the submit form!) if there’s at least 1 WP comment before posting to Discourse. But if you publish/link to Discourse right away, WP commenting disappears. I’m wondering if this is the case even in the block themes? I see you have some WP comments in the demo showing–did you add those before or after posting to Discourse?

Interestingly enough, it looks like it’s designed to work that way. This is the relevant logic with readable names in place of the real code:

if ( "Show Existing WP Comments" is disabled or there's no Wordpress comments ) {
  return only Discourse comments
} else {
  return Discourse comments followed by Wordpress comments
}

Is think the “or there’s no Wordpress comments” part of the conditional could be safely removed if that would help you?

The number or timing of different types of comments won’t effect anything in a block theme as the each block is a contained element, so you get what you see.

1 Like

Would I need to edit the plugin itself (and every time it’s updated) or is there a way to hook into this if-else statement to alter the IF part? It looks like this is indeed what I need to target.

I’m going to look at just removing it in the plugin itself. Hang tight, I’ll let you know.

**edit this change will be in the next version of the plugin (2.5.4)

2 Likes

Just to close the loop on this, since version 2.5.4 the plugin no longer requires at least one existing comment to show Wordpress comments.

1 Like

I confirm that the latest version solves for having both WP & Discourse comments alongside each other for classic themes. Thanks so much!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.