Remove the <small> tags of the "Originally published at" sentence

Hi!

When WP Discourse generates a new topic for a new post, it outputs the “Published at Text” e.g. “Originally published at:” within <small> tags.

Is it possible to disable this <small> tags wrapping? It looks kinda out of place. Even better: if the post URL will be placed on a new line, a nicely polished onebox would be generated.

Like this: https://www.screencast.com/t/GUo82Y2Fb

Looking forward to your reply. Perhaps this makes a great suggestion for a future update of the plugin? Thanks.

3 Likes

Yes, possibly the plugin should give some options for what template is used when a post is published to Discourse. It’s possible to customize the template that is used now. Take a look at the WP Discourse template customization topic to see how it’s done.

I like the image that you linked to. It’s possible to publish posts in that format by using a template similar to the one in this post. If you change the template in that post to this, it should give you what you are looking for.

function wpdc_custom_publish_format_html() {
	ob_start();
	?>
    This topic is to discuss the following lesson on {blogurl}<br>
	<?php
	the_permalink();
	$output = ob_get_clean();
	return $output;
}
add_filter( 'discourse_publish_format_html', 'wpdc_custom_publish_format_html' );

You will need to select the Use Full Post Content option on the WP Discourse publishing options tab, and unselect the embed_truncate setting on Discourse for this to work.

3 Likes

Hi @simon

Thanks! I just wanted to let you know your code does output the introduction text, but the permalink is pasted as text and is not generated as a onebox preview. Below code does, I hope this is of any help to other users :slight_smile:

function wpdc_custom_publish_format_html() {
	
	ob_start();
	echo nl2br ("This topic is to discuss the following lesson:\n");
	the_permalink();
	$output = ob_get_clean();
	return $output;
}
add_filter( 'discourse_publish_format_html', 'wpdc_custom_publish_format_html' );
4 Likes