Sunday, January 23rd, 2022

How to Add First Featured Image to any WordPress Theme in 1 H2 Tag 2 Ways?

The code snippet inside this download folder enables you to add your featured image on single post before 1 h2 tag or any other html tag. This means you can insert your image after any paragraph but before 1 title tag like this:

pay attention : Modify the h2 tag in the PHP code to add your select image before any type of HTML tag.

demo video

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

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

installation steps

There are 2 steps:

  1. # Copy and paste one of the PHP code snippets (without the opening PHP tag) at the end of your child theme functions. php file.
  2. # Upload the content-single.php template to your child theme template-parts>content folder so that the template can override your parent theme file but your code is not lost when you update your parent theme.

download folder

Related Tutorials

reader interaction

Source link