最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - How to hide featured images of all posts falling under the same category in wordpress?

programmeradmin2浏览0评论

Is there any plugin or alternative method to hide featured images of all the posts falling under the same category? Please guide.

For example:

There's a website category:

abc/category/fruits Under this category the following posts are published Apple, Mango, Cherry, Orange

All the posts under fruits category have featured images, I want featured images of posts not to appear when someone visits this "category link". Please note that on my homepage I want the images to appear but not in category link.

Is there any plugin or alternative method to hide featured images of all the posts falling under the same category? Please guide.

For example:

There's a website category:

abc.net/category/fruits Under this category the following posts are published Apple, Mango, Cherry, Orange

All the posts under fruits category have featured images, I want featured images of posts not to appear when someone visits this "category link". Please note that on my homepage I want the images to appear but not in category link.

Share Improve this question asked Feb 3, 2022 at 6:53 MS09MS09 1
Add a comment  | 

2 Answers 2

Reset to default 0

You can use a different theme, or create your own child theme where you override the category template, but since every theme is coded differently, it's unlikely a plugin would be able to disable featured images on categories for every theme out there.

You could use css to hide the featured image for the specific catgeory

Eg:

.category-fruits .featured-image img {
  display: none;
} 

Use this post as a guide for various methods on how to target the specific category pages

https://www.wpbeginner.com/wp-themes/how-to-style-individual-categories-differently-in-wordpress/

Using PHP, find the code for displaying the featured image on single.php, and use an if statement to only display the image if it is not in category fruit, something like:

if( !has_category('fruit') ) { // put code for featured image here }
发布评论

评论列表(0)

  1. 暂无评论