Wordpress의 대표 이미지를 Discourse로 전송하여, Discourse에서 이미지를 클릭하면 원래의 Wordpress 포스트로 돌아가게 하세요. 저에게는 아래 방법이 잘 작동합니다. 도움이 되길 바랍니다:
add_filter( 'discourse_publish_format_html', 'my_custom_publish_format', 10, 2 );
function my_custom_publish_format( $output, $post_id ) {
$post = get_post( $post_id );
$title = get_the_title($post->ID);
$url = get_permalink($post->ID);
if ( has_post_thumbnail( $post_id ) ) {
$image = ' [ . ')](' . $url . ')' ;
} else {
$image = "";
} ?>
<?php ob_start(); ?>
<small>원본 게시 위치: {blogurl}</small><br>
<?php echo $title ?><br>
<?php echo $image ?>
<?php $output = ob_get_clean();
return $output;
} ?>