# Add button with link post forum

**URL:** https://meta.discourse.org/t/add-button-with-link-post-forum/173668
**Category:** WordPress
**Created:** [December 18, 2020, 12:30am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668 "2020-12-18T00:30:22Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![McFlyPartages](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcflypartages/32/197179_2.png) [@McFlyPartages](https://meta.discourse.org/u/McFlyPartages)
#### Post date: [December 18, 2020, 12:30am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/1 "2020-12-18T00:30:22Z")

</div>

> update 2.

Hello,

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:

1. 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.

1. 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.  
 ![cpture liens auto](https://global.discourse-cdn.com/meta/original/3X/1/e/1ef0a348874f4c32bee0b77de90212ea7e14f3b4.png)

Note: I use DIVI as a Theme builder for my WordPress

Thanks in advance and sorry for my poor English.

Thank you

[HACF] ([https://hacf.fr](https://hacf.fr)) French Community of Home Assistant

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [December 18, 2020, 1:19am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/2 "2020-12-18T01:19:06Z")

</div>

Is this it? [Embed Discourse comments on another website via Javascript](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963)

---

<div class="post-metadata">

### Author: ![McFlyPartages](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcflypartages/32/197179_2.png) [@McFlyPartages](https://meta.discourse.org/u/McFlyPartages)
#### Post date: [December 18, 2020, 8:14am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/3 "2020-12-18T08:14:13Z")

</div>

I just looked at the topic, I can’t find a way to add a unique link that automatically leads to the forum link.

I think this information should be stored somewhere and usable as a variable?

Thank you for your quick response anyway.

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [December 18, 2020, 8:23am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/4 "2020-12-18T08:23:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![McFlyPartages](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcflypartages/32/197179_2.png) [@McFlyPartages](https://meta.discourse.org/u/McFlyPartages)
#### Post date: [December 18, 2020, 8:26am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/5 "2020-12-18T08:26:20Z")

</div>

In fact this function exists because it automatically appears in the comments.

 ![cpture liens auto](https://global.discourse-cdn.com/meta/original/3X/1/e/1ef0a348874f4c32bee0b77de90212ea7e14f3b4.png)

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [December 18, 2020, 8:27am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/6 "2020-12-18T08:27:14Z")

</div>

Oh so you’d like to change the text link to a button?

---

<div class="post-metadata">

### Author: ![McFlyPartages](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcflypartages/32/197179_2.png) [@McFlyPartages](https://meta.discourse.org/u/McFlyPartages)
#### Post date: [December 18, 2020, 8:57am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/7 "2020-12-18T08:57:10Z")

</div>

I would like that when I click on the button it sends me directly to the post.

But I would like a button containing the automatic URL so as not to have to copy paste the address each time.

I do not know if I am clear

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [December 18, 2020, 9:03am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/8 "2020-12-18T09:03:30Z")

</div>

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?

> [@Embed Discourse comments on another website via Javascript](https://meta.discourse.org/t/embed-discourse-comments-on-another-website-via-javascript/31963/1):
>
> ### Embedding on more than one page
> 
> In the above example we hard coded our `http://example.com/blog/entry-123.html` URL when embedding the snippet of Javascript. This usually won’t be enough as many sites have many pages that are generated automatically. For example on a blog each entry typically gets its own page. To support this, put the same snippet on each page you want to display comments on, but replace the value passed to `discourseEmbedUrl` with the current page’s URL. On my blog, I use the following value for `discourseEmbedUrl` : `'http://eviltrout.com<%= current_page.url %>'` – as new blog pages are created, new topics will be created for them automatically on Discourse.

---

<div class="post-metadata">

### Author: ![McFlyPartages](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcflypartages/32/197179_2.png) [@McFlyPartages](https://meta.discourse.org/u/McFlyPartages)
#### Post date: [December 18, 2020, 9:07am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/9 "2020-12-18T09:07:37Z")

</div>

There is a part that matches, but this leads to important modifications while I think there is a much simpler solution with variables

I will edit my first post to explain in more detail.

Thanks for precious help

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [December 18, 2020, 9:16am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/10 "2020-12-18T09:16:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![McFlyPartages](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcflypartages/32/197179_2.png) [@McFlyPartages](https://meta.discourse.org/u/McFlyPartages)
#### Post date: [December 18, 2020, 9:37am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/11 "2020-12-18T09:37:04Z")

</div>

Thanks again for your help.

I think there is a possibility via the variables in a simple way but I do not think I use the right search terms with my English very French lol

First post updated

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [December 18, 2020, 10:26am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/12 "2020-12-18T10:26:48Z")

</div>

> [@McFlyPartages](#):
>
> I think there is a possibility via the variables

Maybe this: [Worpdress Shortcode of Current URL | Prodjex](https://www.prodjex.com/2017/07/worpdress-shortcode-current-url/)

---

<div class="post-metadata">

### Author: ![McFlyPartages](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcflypartages/32/197179_2.png) [@McFlyPartages](https://meta.discourse.org/u/McFlyPartages)
#### Post date: [December 18, 2020, 10:31am UTC](https://meta.discourse.org/t/add-button-with-link-post-forum/173668/13 "2020-12-18T10:31:54Z")

</div>

Thank you I’ll look at this as soon as I have a little time
