Site logo

Archived topic

Removed featured post on author page

5 replies · Started by Joey on August 6, 2020

Viewing posts 1–6 of 6

I have the first post of my blog marked as "featured" in the customize options. It looks good but it also makes the first post featured on my author pages. Is there a way to make the author pages just a regular grid without a featured post but leave the rest of the site as is? I don't want to remove the post, just make it small in a grid with her other posts.

For example, on this page I'd like it to be a regular grid without the big featured post:
https://simipress.com/author/xinan_nancy/

Hi there,

you can use the: option_generate_blog_settings filter:

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

This code is:

add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
    if ( is_author() ) {
	    $options['featured_column'] = false;
    }
  
    return $options;
}

Thank you David. It worked well to remove the featured post but I have a longer excerpt on the featured post of the author page still. I had used the following code to make the excerpt longer:

add_filter( 'excerpt_length', function( $length ) {
    global $wp_query;
    if ( 0 === $wp_query->current_post && !wp_is_mobile() && !is_paged() ) {
        $length = 50;
    } else {
        $length = 20;
    }
	return $length;
}, 200);

Is there a way I can modify this code so it doesn't affect the author pages?

Try this condition:

if ( 0 === $wp_query->current_post && !wp_is_mobile() && !is_paged() && !is_author() ) {

That worked. Thank you David.

You're welcome

This archived topic is closed to new replies.