How to display only Title in Category / Archive page in Genesis

Tag: |   Category:

If you want to display only Title (without post content) in your Category / Archive page, you have two options...

OPTION 1

1. Create new PHP page called 'category.php' in your child theme, and paste below code.

<?php
/**
*
* This file adds a custom archive page to any Genesis child theme.
*
*/

//* Remove the breadcrumb navigation
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );

//* Remove the post content
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );

//* Remove the post image
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );

//* Remove the post meta function
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );

genesis();

2. You can use blow CSS to control your layout (just an optional)

.category .content .entry {
      margin-bottom: 0;
      padding-bottom: 0;
      padding-top: 20px;
}
.category .content .entry-title {
    font-size: 2rem;
    text-align: center;
}
.category .content .entry-title a {
    color: #c3251d;
}
.category .content .entry-title a:hover{
    color: #801813;
}
.category .archive-title		{
}
.category .entry-meta    { 
}

OPTION 2

1. In your theme setting/customizer under Entry excerpts choose 0 (zero) for word limit.

2. Paste below code in your functions.php file

//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'sp_excerpt_length' );
function sp_excerpt_length( $length ) {
    return 0; // pull first 0 words
}
// Add Read More Link to Excerpts
add_filter('excerpt_more', 'get_read_more_link');
add_filter( 'the_content_more_link', 'get_read_more_link' );
function get_read_more_link() {
   return '<a href="' . get_permalink() . '"></a>';
}
Copyright © 2024 Siam Naulak.
magnifiercrossmenu