Support » Fixing WordPress » Display thumbnails as first image

  • Hichamitooo


    Hi everyone,

    Can someone show me how to display thumbnails as first image in the left corner of post content.


Viewing 1 replies (of 1 total)
  • Hichamitooo


    I found this function but this add the featured image after a paragraph.
    how to make it add it in top left corner?

    add_filter('the_content', function($content)
       $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
       $img = '<img src="'.$url.'" alt="" title=""/>';
       $content = preg_replace('#(<p>.*?</p>)#','$1'.$img, $content, 1);
       return $content;

    help please

Viewing 1 replies (of 1 total)
  • The topic ‘Display thumbnails as first image’ is closed to new replies.