wp_trim_excerpt

FILTER wp-includes\formatting.php (ligne 3938) github
Filters the human-readable difference between two timestamps.
traduction française
Filtre la différence lisible par l'homme entre deux horodatages.

Paramètres

Entrée :
$text = '', $post = null
Sortie :
@param string $since The difference in human-readable text.
@param int    $diff  The difference in seconds.
@param int    $from  Unix timestamp from which the difference begins.
@param int    $to    Unix timestamp to end the time difference.
@param string             $text Optional. The excerpt. If set to empty, an excerpt is generated.
@param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default null.
@return string The excerpt.

Utilisation

Filtrer le texte de l'extrait généré

Filtre pour modifier l'extrait généré.

frontend content
add_filter('wp_trim_excerpt', 'custom_excerpt_length');
function custom_excerpt_length($excerpt) {
    return substr($excerpt, 0, 100) . '...';
}

Actualités

Chargement des actualités...