# WP-discourse: how to deal with shortcodes in post

**URL:** <https://meta.discourse.org/t/wp-discourse-how-to-deal-with-shortcodes-in-post/58838>\
**Category:** WordPress\
**Created:** [10.Март.2017 17:15:03 UTC](https://meta.discourse.org/t/wp-discourse-how-to-deal-with-shortcodes-in-post/58838 "2017-03-10T17:15:03Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [30.Сентябрь.2019 17:28:22 UTC](https://meta.discourse.org/t/wp-discourse-how-to-deal-with-shortcodes-in-post/58838/8 "2019-09-30T17:28:22Z")

</div>

> [@jrgong](#):
>
> Теперь я хочу скрыть текст поста в теме, чтобы он находился функцией поиска и корректно индексировался поисковыми роботами.

Вы можете скрыть текст поста с помощью CSS, обратившись к атрибуту `data` в теме вашего сайта Discourse. В WordPress оберните фрагмент поста в div с атрибутом `data`, например `data-hide="true"`:

```php
add_filter( 'discourse_publish_format_html', 'wpdc_custom_discourse_publish_format_html', 10, 2 );
function wpdc_custom_discourse_publish_format_html( $output, $post_id ) {
	$permalink = get_the_permalink( $post_id ) . '?embed=true';
	ob_start();
	?>
    <div data-hide="true">{excerpt}</div>
    <iframe width="690" height="600" src="<?php echo esc_url( $permalink ); ?>" frameborder="0"></iframe>
	<?php

	return ob_get_clean();
}

```

В Discourse добавьте что-то вроде этого в вашу тему:

```css
[data-hide="true"] {
    display: none;
}

```

Я не уверен, насколько хорошо это сработает для SEO, но использование атрибута `data` — хороший способ добавить стили к постам, опубликованным из WordPress.

---

_[View the full topic](https://meta.discourse.org/t/wp-discourse-how-to-deal-with-shortcodes-in-post/58838)._
