Duplicate Featured Image Remover

Origin Story In a number of scenarios we’ve used plugins to use the first image in the post as the featured image. That’s nice in that if people forget or are unaware of the featured image it’ll happen automatically and that fits in nicely with how various themes use featured images in various layouts. Where it doesn’t work as nicely is when the featured image is shown in a way that feels duplicative in the single post view. Something like below. I was reminded of one way to solve this after reading Alan’s post yesterday. I’m also trying to do a better job of blogging more1, commenting more, and linking back to posts.2 Who knows maybe people will start believing in RSS readers again? Function For this example I just grabbed the HTML from the base Understrap template and set a featured image and put it in the post body as well. The exact nature of the javascript will change depending on how the theme is setup but this is fairly generic stuff and would likely work on a variety of themes. I commented up the few lines involved so you can see what each one does. Here’s the codepen with the whole thing. I’m repeating my pattern of just copying code there to make life easier for sharing examples […] […]

Read More…

Privacy Statement