Friday, September 13, 2024

Wordpress Category Page: Hide Featured Image

WordPress Category Page Customization

Hide Featured Image WordPress

Learn how to customize WordPress category pages by removing featured images and displaying post titles only. Easy-to-follow steps for modifying themes, using CSS, or plugins to create a clean, streamlined category layout.

wordpress category page Abstract digital illustration of WordPress web design customization featuring coding icons, WordPress logo, and category page layouts, emphasizing a clean layout with links and no images, symbolizing CSS and theme modifications.

Option 1: WordPress CSS Hide Featured Images

Modify the Category Template in Your Theme

1. Access your theme’s files:

  • In your WordPress dashboard, go to Appearance > Theme File Editor.
  • On the right sidebar, locate and click on category.php or archive.php (if category.php doesn’t exist).

2. Find and edit the code that displays

the featured image:

  • Look for code like this, which displays the featured image:
    php
    Copy code:

if ( has_post_thumbnail() ) {
the_post_thumbnail();
}

  • Comment it out or remove it:
    Copy code:

// if ( has_post_thumbnail() ) {
// the_post_thumbnail();
// }

  • Keep only the post title link:

Make sure the part of the code responsible for showing the post title remains: Copy code:

<h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>

  • Save changes:

Click on the “Update File” button to save your modifications.

Option 2: WordPress Category Page Links Only

Use Custom CSS (No Coding Involved)

If you prefer not to modify the theme’s code, you can hide the featured images on category pages using CSS.

  1. Go to your WordPress dashboard:

Navigate to Appearance > Customize > Additional CSS.

2.  Add the following CSS: Copy Code

.category .post-thumbnail {
display: none;
}
This CSS hides the featured images (post thumbnails) on category pages.

3.   Publish your changes.

 

Option 3: WordPress Theme Modification

Use a Plugin (No Coding Needed)

You can also use a plugin to customize how category pages display without touching the code.

  1. Install the “Code Snippets” plugin (optional):
  • Go to Plugins > Add New.
  • Search for Code Snippets and install the plugin.
  • Once activated, go to Snippets > Add New and paste the following code to remove featured images on category pages:
    Copy code
    function remove_featured_images_category() {
    if ( is_category() ) {
    remove_action( ‘genesis_entry_content’, ‘genesis_do_post_image’, 8 );
    }
    }
    add_action( ‘wp’, ‘remove_featured_images_category’ );
  • Save and activate the snippet.
    These methods should allow you to hide the featured images on category pages and display only the post titles.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

All About Feng Shui

What is Feng Shui? All About Feng Shui Harmony in Design Explore the principles of Feng Shui and how they create harmony and balance in you...