# Include the featured image in the post

**URL:** https://meta.discourse.org/t/include-the-featured-image-in-the-post/58196
**Category:** WordPress
**Created:** [3월 1, 2017, 8:42오후 UTC](https://meta.discourse.org/t/include-the-featured-image-in-the-post/58196 "2017-03-01T20:42:57Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Del33t](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@Del33t](https://meta.discourse.org/u/Del33t)
#### Post date: [3월 2, 2017, 10:46오후 UTC](https://meta.discourse.org/t/include-the-featured-image-in-the-post/58196/5 "2017-03-02T22:46:53Z")

</div>

Alright, I tried to get that to work but I was thrown a PHP error. (unexpected \< somewhere). I was able to add your other suggestion perfectly fine, [Clearing the text from the shortcode - #5 by Del33t](https://meta.discourse.org/t/clearing-the-text-from-the-shortcode/58036/5), but not when including the featured image. I imagine I’m copy+pasting too many things or the wrong things into my function.php file. I’m honestly confused with the majority of the following paragraph:

> This can be done in a custom template by copy and pasting the publish\_format\_html() function from it’s github, renaming the function by adding a namespace, adding the {featuredimage} template tag, removing the call to apply\_filters from the function’s return statement, and then hooking into the new function. Note: you also need to remove the self::get\_text\_options() statement from the original function.

And then additionally confused by the code you’ve added following it.

My function.php file is super simple at the moment:

```
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 15 );
function theme_enqueue_styles() {
    wp_enqueue_style( 'youplay-child', get_stylesheet_directory_uri() . '/style.css' );
}

add_filter( 'wp_discourse_excerpt', 'my_namespace_fix_shortcodes' );

function my_namespace_fix_shortcodes( $excerpt ) {
    $excerpt = str_replace( '[nk_title]', '<h2>', $excerpt );
    $excerpt = str_replace( '[/nk_title]', '</h2>', $excerpt ); 
    $excerpt = str_replace( '[yp_text]', '<p>', $excerpt );
    $excerpt = str_replace( '[/yp_text]', '</p>', $excerpt );

    $excerpt = preg_replace('(\\[([^[]|)*])', '', $excerpt );

    return $excerpt;
}

```

Sorry for my confusion, but do you have an guidance on this?

---

_[View the full topic](https://meta.discourse.org/t/include-the-featured-image-in-the-post/58196)._
