Site logo

Archived topic

Display:None for Author & Date by Category

3 replies · Started by Tim on March 15, 2020

Viewing posts 1–4 of 4

Hello

I just purchased Premium to remove Author and Date elements from posts that belong to a particular category only.

How can I achieve this ?

Thanks

Hi there,

you can use the Blog Options filter:

https://docs.generatepress.com/article/option_generate_blog_settings/

TLDR - add this PHP Snippet to your site:

add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
    if ( in_category( 'category-slug' ) ) {
        $options['single_date'] = false;
        $options['single_author'] = false;
    }
  
    return $options;
}

Edit this line:
if ( in_category( 'category-slug' ) ) { and change the category-slug to match your requirements.

Adding PHP: https://docs.generatepress.com/article/adding-php/

Thank you David for your support and resolving my first query.

Glad to be of help - Welcome to GeneratePress Premium

This archived topic is closed to new replies.