Dr. Alex Dong's Blog

Remove featured image from wordpress post

No comments

Wordpress-Best-Theme (1)

Problem

When we write posts by using wordpress, the featured images normally is displayed before the main content of the post which is shown as the following:

featured images

Just due to the peronal taste, I want to remove the freatured image from the post. I have searched many blogs such as:

https://wordpress.org/support/topic/how-do-i-stop-the-featured-image-showing-in-post-as-well

But they do not work in my case.

Solution

Finally, i found the public_html/wp-content/themes/lambda-theme/partials/blog/posts/normal/post.php has the following code:

<?php if( has_post_thumbnail() && !is_search()) : ?>
<div class=”post-media”>
<?php get_template_part( ‘partials/blog/posts/normal/featured-image’ ); ?>
</div>
<?php endif; ?>

We can just remove the code from featured-image.php, the feature image will disappear from post.

But, modifying the child theme is a better practice than directly remove the code from the main theme. To do this, i created a file called:

public_html/wp-content/themes/lambda-child-theme/partials/blog/posts/normal/post.php

Copy all the code from the mian theme featured-image.php and then remove the above codes from it.

The final post looks like:

no featured images

adminRemove featured image from wordpress post

发表评论

电子邮件地址不会被公开。