[Resolved] Removed featured post on author page

Home Forums Support [Resolved] Removed featured post on author page

Home Forums Support Removed featured post on author page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1390209
    Joey

    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/

    #1390795
    David
    Staff
    Customer Support

    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;
    }
    #1393450
    Joey

    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?

    #1393841
    David
    Staff
    Customer Support

    Try this condition:

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

    #1394543
    Joey

    That worked. Thank you David.

    #1394571
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.