Use Generic Copy Whenever Publishing a Post

(Andrew Pautler) #1

@Simon_Cossar Right now whenever you publish a post from WordPress to Discourse the two options are excerpt or full post. Is it possible to simply have generic text (ex. Have a comment or question about this lesson? Start the discussion here.)? We are really just using Discourse to use as the discussion platform and bringing over the text from the post in WordPress doesn’t make a lot of sense.

(Simon Cossar) #2

You can do this by customizing the template that is used to send the WordPress content to Discourse. There is some information about how to do that here: WP Discourse template customization

Adding something like this to your functions.php file should work. Insert whatever html you want to use between the closing and opening php tags.

function your_namespace_publish_format_html() {

    <p>Generic content to be published to Discourse with every WordPress post...</p>

	$output = ob_get_clean();

	return $output;
add_filter( 'discourse_publish_format_html', 'your_namespace_publish_format_html' );

(Andrew Pautler) #3

This worked perfectly, thank you!