Registre el shortcode , idealmente en un complemento o functions.php si tiene que hacerlo.
add_shortcode('thumbnail', 'thumbnail_in_content');
function thumbnail_in_content($atts) {
global $post;
return get_the_post_thumbnail($post->ID);
}
Agregue el shortcode a su contenido.
[thumbnail]
Si desea más funciones, consulte esta publicación o la pastebin .
AÑADIR TITULARES Y ENLACES
add_shortcode('thumbnail', 'thumbnail_with_caption_shortcode');
function thumbnail_with_caption_shortcode($atts) {
global $post;
// Image to display
$thumbnail = get_the_post_thumbnail($post->ID);
// ID of featured image
$thumbnail_id = get_post_thumbnail_id();
// Caption from featured image's WP_Post
$caption = get_post($thumbnail_id)->post_excerpt;
// Link to attachment page
$link = get_permalink($thumbnail_id);
// Final output
return '<div class="featured-image">'
. '<a href="' . $link . '">'
. $thumbnail
. '<span class="caption">' . $caption . '</span>'
. '</a>'
. '</div>';
}
RESULTADOS