Use the current_post
property of the WP_Query
object:
function new_excerpt_length($length) {
global $wp_query; // assuming you are using the main query
if ( 0 === $wp_query->current_post)
return 50;
else
return 20;
}
The function may need further tweaks to avoid interfering with other queries in unintended ways, but that is the basic idea.
Related Posts:
- Remove more or […] text from short post
- How can i limit the character length in excerpt? [duplicate]
- How can I create a “Read More” link using the_excerpt() on a static front page?
- How to include line-breaks in the_excerpt?
- How to control manual excerpt length?
- excerpt in characters
- Remove Ellipses from Excerpt
- Custom excerpt length on home page
- the_excerpt() or get_the_excerpt with shortcode escape
- Modify Twenty Fourteen Home Page Content Limit & Add Read More Link
- Custom Excerpt is returning 52 characters and not 52 words
- Disable WYSIWYG rich text editor only on post excerpt
- How to remove “Read on” content in the_excerpt?
- excerpt_length not working
- Read more does not show up when I write my own Excerpt
- can hyperlinks be displayed in excerpts?
- Making oEmbed work on the excerpt field
- How to get excerpt correctly formatted
- Read More for Excerpt not working
- Twenty Fourteen: Change Read More text
- Read more on the post page itself
- wp_trim_words is trimming by character instead of by words
- adjust the_excerpt based on template page
- First letter cutting off in excerpt
- How to display links in excerpt? [duplicate]
- Getting the_excerpt to link to child pages [closed]
- Show read more link next to last word
- the_excerpt – want to modify password protected output
- Excerpt – add the last few words of posts to the […]
- excerpt – don’t use main content if empty
- Any way to get more space for editing post excerpts
- Show validation warning if no Excerpt is added
- Remove box character after excerpts. Special Character Bug
- Where is the logic that defines the excerpt?
- Custom Excerpts Per Page
- Gutenberg is Adding Additional HTML Tags When Grabbing the Excerpt
- Excerpt_length nor the_excerpt not working correctly
- How to remove first three words from content and display the excerpt
- Why is my excerpts not showing if not explicitly declared?
- How to get the nivo slider to show excerpt [closed]
- Add “Excerpt” in “Quick edit”
- How to wrap “Read More” link in a DIV tag?
- how to get excerpt without p html tag from wordpress post
- How to get only manual excerpts?
- the_excerpt not displaying
- excerpt display same text
- Problem with viewing single page correctly. (taken half way down the page on click through)
- get video from content
- Show image in excerpt post. Image not displaying
- the_excerpt() and tag
- Post excerpt in custom meta box… help with proper php format
- PHP Code in excerpt?
- Limiting the number of characters in the except
- Private Post BUT Public excerpt on Homepage
- Replacing the ellipsis with three dots
- The Excerpt gets page excerpt instead of most recent post excerpt
- Make only the image an anchor link using the advanced excerpt plugin?
- Why archive page can’t show full content?
- Manual excerpt length on recent posts slider
- Remove ‘read more’ link when post is shorter than excerpt
- truncate post with gallery tag
- Removing the […] from the excerpt returned by get_the_excerpt() only in some places
- Excerpt not alway available
- Continuum Theme – Excerpt length
- Prevent Advanced Excerpt from Being Called
- What’s the internal concatenation function for creating Excerpts with WordPress?
- “Continue reading” not on some posts, full excerpts not shown
- Get the automatic excerpt from a page created with gutenberg
- Read More excerpt link on a post is not linking to the post itself
- Relia Theme Homepage Articles Excerpt displays the current page excerpt not the posts being pulled
- get_the_excerpt only returns one excerpt
- How to extract an excerpt from a specific page?
- Display Full Content Instead of Excerpt
- How to use limit post content on archive page in WordPress?
- Remove Default Read More Link in Manual Excerpt RSS Feed
- How to custom excerpt?
- “read more” tag for excerpt() won’t show full content
- Unable to show excerpts
- modify text at the bottom of excerpt editor
- excerpt button not going to custom post page
- Excerpt preview
- Excerpt “Read More” link
- Force authors to use Manual Excerpt in WordPress and multiple Manual Excerpts
- Manual excerpt being ignored on custom post type
- Remove “[ ]” from excerpt in highlight search term
- Excerpt filter is adding ” in incorrect place
- Trimming breaks up markup
- WordPress excerpt with formatting and allowing selected tags
- multiple excerpt length and styles
- How to display page excerpt with readmore link inside an enhanced widget?
- how to use the_excerpt for two post queries?
- Excerpt Problems
- Function to shorten string without cutting off last word
- Implementing a blog excerpt in custom theme
- Get the excerpt of post_content
- Get a raw value of excerpt
- Excerpt length and alignment [duplicate]
- Opening file, editing, save, exit, open, edited version opens?
- Format main page post excerpt previews
- Is there a way to display the ‘Read more’ link if it’s within a range?