Wp-discourse-shortcodes 插件

I got some funding to do this recent work on it. It will be safe to use by the end of the week. Right now, it’s lacking documentation and the options page needs to be cleaned up. I’m supporting the plugin, so if people use it now and run into any problems, I’ll fix it.

9 个赞

I’m a newb to wordpress and discourse… coming from a good php background with other forum software.

I have WP and Discourse installed and working perfectly with the wp-discourse plugin and discourse acting as SSO.

I can’t get these shortcodes to work for me though. I installed by downloading the zip from git and uploading that zip as a plugin. It took it and it’s activated and the shortcode page shows up within the Discourse section of the WP admin. I’ve tried adding the discourse_topics and discourse_link shortcodes and I get nothing. I’ve tried a few different ways: in a text widget (with my theme modded to allow for short codes), in the shortcode widget itself, and within a normal post.

I’ve tested a couple other shortcodes to make sure shortcodes in general are working.

Anything I’m missing in the setup?

Really want to get some of the discourse embedded in wordpress and it looks like your shortcodes are the best option currently.

Many Thanks,
Mac

1 个赞

Is your forum private? If so, you need to check the Enable Private Topics checkbox on the Shortcodes options page.

If you’re still getting no output, try disabling the Webhook setting if you have it enabled, and using this as the shortcode: [discourse_topics cache_duration=0] It should give you some output. If not, please let me know.

4 个赞

YES. That was it. I had locked things down a bit as I’m converting to Discourse from my old forum software.

Awesome stuff. Thanks so much for the quick reply.

2 个赞

Are you planning to add an option to filter discourse_topics by categories and tags?

We love this plugin! Thank you very much for the work put in it. We use it very prominently at the https://confederac.io homepage.

I second @anon36484860, it would be useful to display items of a single category. For instance:

[discourse_topics source="top" category=" period="weekly" max_topics="5"]

On a different, there seems to be a minor bug. A category is not displayed in the widget:

Screenshot%20from%202018-10-01%2023-23-33

The category is “Anti-Represión” and is in fact a subcategory. The tilde seems to be fine, because the category “Colaboración” is rendered without problems. Maybe it’s the dash?

Have you recently added the category? If so, go to the Publishing options tab, select the Force Category Update checkbox and save the page. If that doesn’t solve the issue, I’ll take a look at what’s going on.

Yes, adding a Category option is a good idea.

2 个赞

Doh. OK, problem fixed. Thank you. :blush:

2 个赞

Is this plugin still maintained?

I would love to see the ability to make a list of topics by entering individual topic IDs

We are still very interested in this feature. Would it be complex to implement? Would the paid model be an option here?

1 个赞

Hello, Simon.

How to add a script to these ednpoints that will change them e.g. on the basis of api ?
For example:

On my wordspress blog:

Latest Topic discussion (imported from duscourse):
Topic 1 // My City is beauty
Topic 2 // How my Paris looks like
Topic 3 // My trip in New York

And i want to make it like this:
Topic 1 // My City is beauty – null (no city)
Topic 2 // How my Paris looks like + (weather from api for Paris)
Topic 3 // My trip in New York + (weather from api for New York)

etc

这个插件的状态如何?

我无法让用户的头像显示出来,也无法控制 date_position。后者没问题,但我真的很希望能显示头像。

我使用了以下代码:[discourse_topics source="latest" tile=true excerpt_length="55" date_position=bottom]

得到的输出如下:

我哪里做错了?

@simon 你在吗……?:smiley:

1 个赞

你能检查一下头像的 src 元素的值吗?你可以使用浏览器的网页检查器找到它。这将帮助我们了解问题所在。

1 个赞

<img class="wpds-latest-avatar" src="">

所以没有截图……

1 个赞

我周一之前无法测试这个。我会设置提醒,到时候再查看。快速浏览代码后,头像的 src 应该会为您自动设置。不过,我在代码中没看到任何处理 date_position=bottom 参数的地方。从短代码参数中移除 date_position 会有什么不同吗?

可能现在该插件的大多数用途都可以通过 Embedding a list of Discourse Topics in another site 来实现。

好的,我自己试着修复了一下,但没能成功……

目前……

……还太基础了。

能否私信我一下您正在使用短代码的帖子链接?我来查看一下头像 URL 的问题。

我查看了您正在拉取话题的网站。问题在于,为了获取“原帖作者”的头像模板,该插件会遍历每个话题的发帖人,以查找描述为“Original Poster”的发帖人。由于您的网站是丹麦语的,应该搜索的描述应为“Oprindelig forfatter”(丹麦语中的“原帖作者”)。

我不确定是否有更好的方法从话题列表中查找“原帖作者”。如果您希望尝试在自己的网站上修复此问题,需要修改的代码位于此处:wp-discourse-shortcodes/lib/discourse-topic-formatter.php at master · communiteq/wp-discourse-shortcodes · GitHub /Original Poster/ 替换为 /Oprindelig forfatter/ 应该可以解决您的问题。

我认为我不会修复 date_position=bottom 相关的问题。我将从插件的 README 中移除该参数。我非常喜欢这个插件,但据我了解,在 WordPress 上,短代码已不再是实现此类功能的最佳方式。如果能有一个新插件,允许您在 WordPress 帖子中添加一个 Discourse 话题列表 区块,那就太好了。

4 个赞

问题解决了 :smiley:

谢谢!