Thumbail after first paragraph

by artyak   Last Updated July 12, 2019 16:08 PM

I try to make future image display after first paragraph with this functions.php code:

add_filter( 'the_content', 'insert_featured_image', 20 );

function insert_featured_image( $content ) {

    $content = preg_replace( "/<\/p>/", "</p>" . get_the_post_thumbnail($post->ID, 'post-single'), $content, 1 );
    return $content;
}

and i received this:

enter image description here

how i can make indent, for example with <br />?

Tags : plugins code


Related Questions



load plugin in code snippet

Updated May 08, 2019 19:08 PM

I want to replace all slider here

Updated August 02, 2019 08:08 AM

How to save inputed data in a textbox [EDITED]

Updated July 22, 2018 14:08 PM

Hide a category/posts from the homepage in wp

Updated January 03, 2019 10:08 AM