# WP Discourse - テンプレートのカスタマイズ

**URL:** <https://meta.discourse.org/t/wp-discourse-template-customization/148327>\
**Category:** WordPress\
**Created:** [2020 年 4 月 17 日午前 8:36 UTC](https://meta.discourse.org/t/wp-discourse-template-customization/148327 "2020-04-17T08:36:06Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![aio](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@aio](https://meta.discourse.org/u/aio)\
**Post date:** [2020 年 4 月 19 日午前 3:21 UTC](https://meta.discourse.org/t/wp-discourse-template-customization/148327/6 "2020-04-19T03:21:44Z")

</div>

美しく動作します！！！ありがとうございます！！！

ただし、1 つではなく 2 つの埋め込みが表示されています。

出力は以下の通りです。私が以前提案したコードに問題がありますか？

`<small>Originally published at http://staging.a1.sg/beautiful/</small><br><br><iframe src="https://www.youtube.com/embed/alJEZwwtQ3U" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe><br><p><iframe src="https://www.youtube.com/embed/alJEZwwtQ3U" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>`

```
add_filter( 'discourse_publish_format_html', 'my_namespace_publish_format', 10, 2 );
function my_namespace_publish_format( $input, $post_id ) {
	$post_content = apply_filters( 'the_content', get_post( $post_id )->post_content );
	$videos = get_media_embedded_in_content( $post_content );
	$video_string = '';
	foreach( $videos as $video ) {
	    $video_string .= $video . '<br>';
    }
    ob_start();

    echo '<small>Originally published at {blogurl}</small><br><br>';
    echo $video_string;
    echo '{excerpt}';
    $output = ob_get_clean();

    return $output;

```

---

_[View the full topic](https://meta.discourse.org/t/wp-discourse-template-customization/148327)._
