In post content, you can add featured image before post title as per theme support. But if you already have some content on your website and moving from one theme to another. Then it may be possible that the new theme doesn’t support featured image addition in content. But you want to add featured image in content after first the first paragraph of post content.

Its very simple to show a featured image using the_content filter and using preg_replace function to append featured image in the first paragraph.

2 Comments

  1. When I add this code, this message show me – prase error : syntax error, expecting ‘}’ on line 5

    1. Mohit Chawla says:

      Seems you copied the starting php tag

      Use this at the end of url to open the admin url

      ?snippets-safe-mode=true

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.