Using CSS To Only Display Title On Category Archives

I was recently asked how to display the title only on all category archives.

The easiest solution is to simply hide what you don’t want displayed using CSS code in your child themes style.css file.

.category .entry-meta,
.category .entry-content {
display: none;
}

The CSS above will remove both the post info and post meta as well as the excerpt and featured image so only the title displays.

Works on HTML 5 themes only and will need to be modified for theme specific classes.

And here’s the result:

category archives

You can also achieve the same result using PHP code which i will write about shortly.

Related Solutions


Comments

2 responses to “Using CSS To Only Display Title On Category Archives”

  1. Nanci Murdock Avatar
    Nanci Murdock

    Hey Brad,

    In this same idea, I am trying to remove the meta data from all posts in a specific category. So basically, if I categorize a post in the /category/case-studies/ I don’t want it to display the meta data. And really it is only the date I for sure want to hide. Author, tags and category I can live with, but not date.

    I tried:
    [code]
    .category-14 .post-meta {
    display:none;
    }
    [/code]
    I’m using HTML5 Agency Pro from Studiopress..

    But that didn’t work.

    1. Brad Dalton Avatar
      Brad Dalton

      Because it is post info not post meta which is now named entry-meta.

      [code]
      .category-14 .entry-meta {
      display: none;
      }
      [/code]

      Or use PHP:

      [code]
      add_filter( ‘genesis_post_info’, ‘post_info_filter’ );
      function post_info_filter($post_info) {
      if ( in_category(’14’) ) :
      $post_info = ‘[post_edit]’;
      return $post_info;
      endif;
      }
      [/code]

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.