# Wordpress plugin to add link only

**URL:** https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041
**Category:** WordPress
**Created:** [December 9, 2016, 9:45pm UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041 "2016-12-09T21:45:33Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![marclouis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marclouis/32/65704_2.png) [@marclouis](https://meta.discourse.org/u/marclouis)
#### Post date: [December 9, 2016, 9:45pm UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/1 "2016-12-09T21:45:33Z")

</div>

I wanted to setup a couple of wordpress blogs to share a discourse environment, but still leave wordpress native commenting in place, so just add “continue discussion about this post at [discourse.otherdoman.com](http://discourse.otherdoman.com)” above (or below) the native comments, and have that running aon a couple of wordpress blogs.  
Also, I can see bloggers forgetting to tick the post to discourse option, can that be set to enabled by default.  
I have discourse working on stage sites fine as it looks like it’s intended, but can’t figure these two things out.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 10, 2016, 12:03am UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/2 "2016-12-10T00:03:26Z")

</div>

I’m assuming you are using the [WP Discourse](https://github.com/discourse/wp-discourse) plugin.

> [@marclouis](#):
>
> I wanted to setup a couple of wordpress blogs to share a discourse environment, but still leave wordpress native commenting in place

You can publish a post from WordPress to Discourse without enabling Discourse comments for your post. Do this by _not_ selecting ‘Use Discourse Comments’ on the [WP Discourse](https://github.com/discourse/wp-discourse) Commenting setting page and then selecting ‘Publish post to Discourse’ on the WordPress edit page. This will publish your post to Discourse and allow you to have Discourse comments on the forum and WordPress comments on the website. When Discourse comments aren’t being used for WordPress posts, the plugin doesn’t add a ‘continue discussion’ link to the WordPress post. It wouldn’t be to hard to set it up to do that though.

> [@marclouis](#):
>
> Also, I can see bloggers forgetting to tick the post to discourse option, can that be set to enabled by default.

You can set the ‘Auto Publish’ option on the plugin’s Publishing options tab. With this set, the ‘Publish post to Discourse’ checkbox will be pre-checked on the post edit page. It can be unchecked there if you have a post you don’t want to publish to Discourse.

---

<div class="post-metadata">

### Author: ![marclouis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marclouis/32/65704_2.png) [@marclouis](https://meta.discourse.org/u/marclouis)
#### Post date: [December 10, 2016, 12:20am UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/3 "2016-12-10T00:20:58Z")

</div>

Thank you @simon, confirms in both cases I am doing it right, so must be a bug in the plugin or wordpress that the check box is not staying ticked (I’ll debug further).  
Would you know of a short code i could use to add the ‘continue discussion’ link so it took them to the right post in discourse?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 10, 2016, 12:30am UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/4 "2016-12-10T00:30:39Z")

</div>

> [@marclouis](#):
>
> must be a bug in the plugin or wordpress that the check box is not staying ticked

I’m doing some work on the plugin in a couple of days. I’ll look at that as well.

> [@marclouis](#):
>
> Would you know of a short code i could use to add the ‘continue discussion’ link so it took them to the right post in discourse?

There is this: [Wp-discourse-shortcodes plugin](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910)  
I haven’t worked on the plugin for a while. There are some things in it that I want to change about how it deals with groups and messages. The `discourse_link` shortcode should work for you. You’ll need to set `login` to false if you’re not using SSO between your website and your forum. The plugin’s documentation is here: [GitHub - communiteq/wp-discourse-shortcodes: Extends the wp-discourse plugin by adding shortcodes that can be used to link to the Discourse forum. · GitHub](https://github.com/scossar/wp-discourse-shortcodes)

---

<div class="post-metadata">

### Author: ![marclouis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marclouis/32/65704_2.png) [@marclouis](https://meta.discourse.org/u/marclouis)
#### Post date: [December 29, 2016, 2:53am UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/5 "2016-12-29T02:53:02Z")

</div>

@simonstarr checkbox issue resolved, was a caching proxy, refreshing the page shows unticket but really ticked, ticking again really ticks it.

Sorry i dont know what to make of the short codes, is there one that is simply comment\_at\_current\_article?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 29, 2016, 8:04am UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/6 "2016-12-29T08:04:28Z")

</div>

> [@marclouis](#):
>
> is there one that is simply comment\_at\_current\_article

There might be one that will work. Where do you want to put the link to the forum topic?

---

<div class="post-metadata">

### Author: ![marclouis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marclouis/32/65704_2.png) [@marclouis](https://meta.discourse.org/u/marclouis)
#### Post date: [December 29, 2016, 7:13pm UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/7 "2016-12-29T19:13:20Z")

</div>

[quote=“Simon\_Cossar, post:6, topic:54041”]  
Where do you want to put the link to the forum topic?  
[/quote] at the bottom of the content of each wordpress post, to the corresponding autopost at discourse, the idea is to have multiple wordpress sites autoposting to a single discourse (which currently works well) but give the commentators an option of where to comment.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 29, 2016, 11:09pm UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/8 "2016-12-29T23:09:35Z")

</div>

Assuming you’re not using SSO, you could try adding something to your theme’s `functions.php` file that hooks into the WordPress `the_content` filter.

This works quite well with a theme based off the ‘Twenty Sixteen’ theme. You can change the link text in the function, and customize or remove the `$discourse_link_instructions` text.

```php

// Your theme's functions.php file.

function your_site_prefix_discourse_link( $content ) {
    global $post;

    if ( is_single() && get_post_meta( $post->ID, 'publish_to_discourse', true ) ) {
        $discourse_permalink = get_post_meta( $post->ID, 'discourse_permalink', true );
        $discourse_link_instructions = '<p>Leave a comment here, or join the discussion on our forum.</p>';

        return $content . '<div class="discourse-topic-link">' . $discourse_link_instructions . '<a href="' . esc_url( $discourse_permalink ) . '">Comment on our forum</a></div>';
    }

    return $content;
}

add_filter( 'the_content', 'your_site_prefix_discourse_link' );

```

```css

/* style.css */

.discourse-topic-link {
    padding-top: 1.75em;
    border-top: 1px solid #d1d1d1;
    font-family: "Helvetica Neue", sans-serif;
}

.discourse-topic-link a {
    display: inline-block;
    color: #ffffff;
    background-color: #007acc;
    padding: 0.84375em 0.875em 0.78125em;;
    border: 0;
    border-radius: 2px;
    font-family: "Helvetica Neue", sans-serif;
    font-weight: 700;
    letter-spacing: 0.046875em;
    line-height: 1;
    padding: 0.84375em 0.875em 0.78125em;
    text-transform: uppercase;
}

.discourse-topic-link a:hover {
    background: #0091e3;
}

```

 ![](https://global.discourse-cdn.com/meta/original/3X/a/4/a40d366a77cb6a5750023b4e665d8e90999643ae.png)

---

<div class="post-metadata">

### Author: ![marclouis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marclouis/32/65704_2.png) [@marclouis](https://meta.discourse.org/u/marclouis)
#### Post date: [December 30, 2016, 12:37am UTC](https://meta.discourse.org/t/wordpress-plugin-to-add-link-only/54041/9 "2016-12-30T00:37:29Z")

</div>

> [@simon](#):
>
> Assuming you’re not using SSO

yes, that would be a total mess with multiple blogs

as for themes, well I think most of them are Genesis, mine is currently, but it was 2016 last week, but that is very much what I had in mind and enough to get started with, thanks so much.
