7 posts were split to a new topic: Unable to connect WordPress site to Discourse
Hi, i love this plugin made my life perfect for my site.
Was the category selection added, it would be so great is like select category=“news1” and then it would show those in a widget on the news page on wordpress.
I don’t know if this is supported any further, but in case it is, I tried to install the plugin and got errors:
Pups::ExecError: cd /var/www/discourse/plugins && git clone https://github.com/scossar/wp-discourse-shortcodes failed with return #<Process::Status: pid 325 exit 128> Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
Just passing along.
The WP Discourse Shortcodes plugin is a WordPress plugin, not a Discourse plugin, so trying to install it to Discourse would give you that error. You need to download the plugin’s zip file from the Github repo and then upload it to your WordPress site through the WordPress dashboard.
I’m moving away from focusing on WordPress development, so at some point I’d like to stop supporting this plugin, but i’ll keep supporting it until there’s a good replacement for it. I think the functionality that the plugin provides is useful. You can see it on a live site here: | Principles for Digital Development.
The plugin extends the WP Discourse plugin. When you install and activate it, a Shortcodes tab will be added to the WP Discourse options pages that gives you some options for configuring it:
Doh, silly mistake on my part. Understood on moving on, I also looked at the Embedding Topics you mentioned further up which may just do as well for what I need.
I’ve installed and activated the plugin as well as inserted the
[discourse_latest] shortcode into a post (and sidebar) to see the output but nothing shows up. The shortcodes tab does show up in the WP Discourse settings page.
Is there something else I need to do?
Thanks and apologies for adding to your Wordpress misery ; )
I probably can’t test it today, but to be able to use a shortcode in a sidebar text widget, you usually need to add something like this to your theme:
add_filter( 'widget_text', 'do_shortcode' );
I’ll do some testing on the plugin early next week and also clean up this topic’s replies and the plugin’s readme file.
I did try that for the widget, no go. It also doesn’t work directly in posts/pages either using the shortcode block editor.
I can confirm other shortcodes from other areas do work.
No rush at all, just holler my way if I can help any.
Any update on getting this to work? I’ve updated to the latest version but the shortcode still does not work on my site.
Work on this plugin has stopped for the moment. We have a new (excellent) outside contractor maintaining our WordPress plugin. I’ll post an announcement about that later this week. My own work on Discourse/WordPress integration is slowing down for the next while. If someone is interested in taking over maintenance of the wp-discourse-shortcodes plugin, get in touch with me. Since the plugin was developed prior to the introduction of the Block Editor, I’m not sure if the best approach would be to update the plugin to deal with WordPress blocks, or to start over with a new plugin that has similar functionality.
I understand, hopefully the new guy can help out as I really look forward to being able to show latest topics on the website to draw people into the forums.
BTW, is there a way to check if the shortcode is even being processed? On the pages I use it the shortcode text itself shows up as if it’s not a shortcode, i.e. it displays
As the text on the page.
I think I have it sorted – [discourse_latest] isn’t a proper shortcode itself, I thought I saw it somewhere. I switched it to [discourse_topics source=“latest”] and it worked.
PS How can I change the date formatting on the latest topics that show on shortcode, @simon? It shows as 2020-10-20 and I’d rather have it say Oct-20 or similar.
I’m fairly sure that the shortcodes plugin uses the datetime format that is set on the WP Discourse Commenting options tab. Click the link in that setting’s description to see the available options for formatting dates.
That did the trick, thanks!
Could you please add the usernames as avatars titles by default or as a shortcode option, and maybe another option to remove the username ( display_usernames = “false” ?). Meanwhile, if anyone needs this go to
wp-discourse-shortcodes-master/lib/discourse-topic-formatter.php and replace
$avatar_image = '<img class="wpds-latest-avatar" src="' . esc_url_raw( $poster_avatar_url ) . '">';
$avatar_image = '<img class="wpds-latest-avatar" title="'. esc_html( $poster_username ) . '" src="' . esc_url_raw( $poster_avatar_url ) . '">';
Great plugin. Thanks!
Also, the link for categories ( more info here ) as an option inside your shortcode would be also useful.
is this plugin still being maintained?
Yes, we (Communiteq) are maintaining it now.
Doesn’t seem to ‘refresh’ latest posts from Discourse.
Must be doing something wrong,
[discourse_topics source=“latest”] this is the shortcode I’m using.
It has pulled three topics from Discourse but since then I’ve added more topics to see if it pulls through on my WordPress site.
Tried Ajax event and still doesnt seem to pull new posts through