[wp-trac] [WordPress Trac] #28278: Smart Excerpt
WordPress Trac
noreply at wordpress.org
Fri Jan 6 08:33:24 UTC 2017
#28278: Smart Excerpt
--------------------------------------------+------------------------------
Reporter: GreatBlakes | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 3.9.1
Severity: normal | Resolution:
Keywords: needs-patch dev-feedback close | Focuses:
--------------------------------------------+------------------------------
Changes (by grapplerulrich):
* keywords: needs-patch dev-feedback => needs-patch dev-feedback close
Comment:
It is very unlikely that `get_the_excerpt` and `the_excerpt` will be
replaced by another function.
I believe the whole custom function could be replaced with filters and
conditionals. If want a different excerpt length on a certain page you can
use a conditional. With the following code example I can change the
excerpt length just on the category archive.
{{{#!php
<?php
prefix_custom_excerpt_length( $length ) {
if( is_category() ) {
$length = 25;
}
return $length;
}
add_filter( 'excerpt_length', 'prefix_custom_excerpt_length' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28278#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list