Wordpress plugin to add link only

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.


// 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' );


/* 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;
}