How to enable Discourse comments via JavaScript in Wordpress?

I am trying to use

on my wordpress blog because WP-Discourse plugin does not currently support connecting old blog posts to existing (migrated) discourse topics.

My current plan to connect an existing blog post to discourse topic via

  DiscourseEmbed = { discourseUrl: 'http://discourse.example.com/',
                     topicId: 12345 };

However, I don’t know a way to insert HTML code at blog post level that can override existing comment code. That code seems to be outside the scope of a blog post HTML code

@tophee
mentioned a way
https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963/188?u=quintin_par

Was wondering if there is a solution to add the Javascript code per each blog to set the comments?

Note:

  • I am planning to set this code for each blog post manually changing the DiscourseEmbed. topicId for each post.
  • For all the new posts (i.e. posts without any comments so far) I’ll be using WP Discourse.

Why don’t You use the WP Discourse Plugin to do that?

3 Likes

See

That Post is Over a year and Half old, as far as I can see, The WP Discourse Plugin has came a long way since then and comments can indeed be integrated into posts. I haven’t ever had a need to use discourse comments on wordpress but I’m sure that there is a configuration Setting available under the plugin settings for the same.

Hmm no.

Here’s the comment from the author @simon a day back:

Are You trying to display discourse comments on existing wordpress articles?
EDIT: Seems Like a Yes

Did anyone pick this up, yet? Looking to link existing blog post and existing discourse topics.

You can wait until the update for plugin is out as it is going to be a lot of work anyway to individually modify all your posts over wordpress.