Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Support request] Length excerpts only first article

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Length excerpts only first article

  • This topic has 5 replies, 2 voices, and was last updated 4 months ago by Tom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17683
    Horst
    Participant

    Hello,

    can you adjust the length of the excerpt for the output of the 1st article (Featured) and leave the length of the others as in the standard?

    Thanks and regards, Horst

    #17693
    Tom
    Keymaster

    Hi there,

    Not sure if this will work, but you could try:

    add_filter( 'excerpt_length', function( $length ) {
        if ( is_page( 'Your page title' ) ) {
            global $wp_query;
    
            if ( 0 === $wp_query->current_post ) {
                return 200; // Whatever the length you need for the first post.
            }
        }
    
        return $length;
    }, 999 );
    #17699
    Horst
    Participant

    Hello Tom,

    Thanks again for the great support (also on Sundays :-))
    That unfortunately did not work. I entered “Start” as the page, the name of my homepage. I also tried “Home”. Unfortunately without success.

    It’s about the home page. There I use wp-show-post. And only in the first post should the excerpt be longer (see screenshot) Is there an idea?

    My page: https://horstschulte.com

    Best regards, Horst

    longer excerpt

    #17710
    Tom
    Keymaster

    Hmm, instead of is_page( 'Your page title' ), try is_front_page().

    Let me know 🙂

    #17726
    Horst
    Participant

    Hello,

    the change had no effect. 🙁

    Best regards, Horst

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