[Resolved] Longer excerpt on featured post

Home Forums Support [Resolved] Longer excerpt on featured post

Home Forums Support Longer excerpt on featured post

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #428599
    markinbrighton

    Is it possible to increase the except to say 60 words on the featured post. All other posts will just have a 30 work except.

    Many thanks

    Mark

    #428630
    Tom
    Lead Developer
    Lead Developer

    Hi Mark,

    Give this a shot:

    add_filter( 'excerpt_length', 'tu_featured_excerpt_length', 50 );
    function tu_featured_excerpt_length( $length ) {
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        global $wp_query;
    
        if ( 1 == $paged && 0 == $wp_query->current_post ) {
            return 100; // First post
        }
    
        return $length;
    }
    #429777
    markinbrighton

    Thank you, it works perfectly.

    #429927
    Tom
    Lead Developer
    Lead Developer
    #1970010
    Karel

    Hi,

    I would also like to change the excerpt length on the featured post.
    I tried the solution above but it doesn’t seem to work. Is is still valid or am I doing something wrong? I added the code above in the custom CSS.

    Thanks

    #1970034
    Ying
    Staff
    Customer Support

    Hi Karel,

    The PHP snippet is for the 1st post on your blog page.

    If it’s not your case, can you open a new topic and link us to your site?

    Thanks!

    #1970466
    Karel

    Hi Ying,

    Yes, it is for the featured post, which is the first post shown on the blog page.

    Karel

    #1970497
    David
    Staff
    Customer Support

    Hi there,

    that should still work, but its dependent on the site.
    If you want to raise a new topic where you can share a link to your site we can take a look as to why its not working.
    If you could include the URL to this topic in your new one for reference it would be much appreciated.

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