How To Add Featured Image Before 1st H2 Tag 2 Ways In Any WordPress Theme

The code snippets inside this download folder enable you to add your featured image on single posts before the 1st H2 Tag or any other HTML tag. This means you can insert your image after any number of paragraphs but before the 1st heading tag like this :

Note : Modify the h2 tags in the PHP code to add your featured image before any type of HTML tags.

Demo Video

Shows the featured image inserted before the first H2 tag on single posts.

Tested using the Twenty Twenty One default theme for WordPress however will work in any WordPress theme.

Installation Steps

There’s 2 steps :

  1. # Copy & paste one of the the PHP code ( without the opening PHP tag ) snippets to the end of your child themes functions.php file.
  2.  

  3. # Upload the content-single.php template to your child themes template-parts > content folder so the template overrides your parent theme file but your code is not lost when your update your parent theme.
  4.  

Download Folder

Related Tutorials

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.