Conditionally Display Featured Image Problem (WordPress) (Fixed)

Problem and fix for conditionally display featured image after WordPress upgrade

I’ve been working on my website a lot in the past few dates. Updating, upgrading, fixing issues. As my site runs on WordPress, I use a couple of plugins to have the content be displayed in the way that I like. One of these plugins is called “Conditionally display featured image on singular pages and posts”. Yeah, that’s kind of a long name, but it always did what it said: it allowed me to choose whether a featured image would be displayed in the post. If you’re looking to fix ‘Conditionally Display Featured Image’ plugin problem in WordPress plugin issue after a WordPress upgrade. I will tell you exactly how I fixed the problem!

Now, this worked perfectly, up until upgrading WordPress to the newest version. I also upgraded my theme, but I think the problem was caused by upgrading my WordPress version.

Apparently after upgrading to the latest version of WordPress, the setting for the plugin “Conditionally display featured image on singular pages and posts” was no longer checked on any of my existing posts.

That meant I had to either manually set it for about 300 posts, or find another way to fix the issue.

Well, luckily I was able to fix ‘Conditionally Display Featured Image’ plugin problem in WordPress no longer working as it should. This is what I did:

Easy fix: ‘Conditionally Display Featured Image’ Plugin Problem in WordPress

I went to template-parts/content-single.php and looked at the code. There, the following code is displayed:

<?php if ( has_post_thumbnail() ) : ?>
<div class=”entry-thumb”>
<?php the_post_thumbnail( ‘codilight_lite_single_medium’ ); ?>
</div>
<?php endif; ?>

Note: codilight lite is my theme.

What I did, was comment out the PHP code here. Like this:

<?php //if ( has_post_thumbnail() ) : ?>
<div class=”entry-thumb”>
<?php //the_post_thumbnail( ‘codilight_lite_single_medium’ ); ?>
</div>
<?php //endif; ?>

I saved the file and now my problem with this plugin not working properly anymore is solved!

Obviously, I made this note for my own reference. But in case you also discovered that your “Conditionally display featured image on singular pages and posts” plugin doesn’t behave anymore as it should, this might help!

Visits: 0