In a WordPress forum discussion titled ‘Add button with link post forum,’ McFlyPartages seeks to create a reusable button that automatically links to the corresponding Discourse topic for each WordPress post, avoiding manual URL entry. They note that while Discourse auto-generates topics from WordPress posts, changing titles or URLs breaks links. They also observe that comment sections already display auto-generated links but want to convert them into buttons. Jonathan5 suggests using the Discourse embedding script with dynamic variables like <%= current_page.url %>, which auto-generates topics per page. McFlyPartages confirms the auto-link exists in comments but wants it as a button. Jonathan5 clarifies that the variable approach is likely the solution, and later shares a resource on retrieving the current URL via WordPress shortcodes hereJonathan5. McFlyPartages thanks them and plans to review the resource. The discussion centers on leveraging WordPress variables or shortcodes to dynamically generate Discourse topic links without manual intervention, ideally via a global button block in DIVI theme.
First of all thank you for this plugin which, once followed by the subject on the configuration, is a real wonder.
I’m trying to create a button with, as URL, the links to the associated forum topic.
It would be in the form of a “global block” or “same button for all post” which I would like not to have to put the url every time.
Two tracks can be useful I think:
Topics automatically created by WordPress to Discourse are in the form `` https: // discourse.url / post-title```
Problem:
I first created the articles on the forum then once mature I published it on the site.
If I change a title or the links it won’t work or no longer.
Get the variable (if there is one) and either create a shortcode (I don’t know how to do) or maybe via the WordPress variables and create a special URL.
I think the embedding process creates an unlisted topic for each external page it’s used on, which gets listed whenever a reply is posted. Otherwise I don’t think there would be a way of automatically knowing which forum post to link to.
I couldn’t get it to work myself but I think that was a problem with my site rather than Discourse.
You are probably being clear enough for someone who knows more about it For me, you’d have to describe the steps you’ve taken, what happens and what you want to happen. But do you think this may be your answer?
De rien. Maybe it’s as well to add the information here or I’ll look more of an idiot for missing the point In the quoted post above, <%= current_page.url %> is a variable, and I imagine there will be an equivalent for your website.