The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Display thumbnails as first image (2 posts)

  1. Hichamitooo
    Posted 3 years ago #

    Hi everyone,

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


  2. Hichamitooo
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic