wp_trim_words

FUNCTION wp-includes\formatting.php (ligne 3991) github
This filter is documented in wp-includes/post-template.php  		$text = apply_filters( 'the_content', $text ); 		$text = str_replace( ']]>', ']]>', $text );  		// Restore the original filter if removed. 		if ( $filter_block_removed ) { 			add_filter( 'the_content', 'do_blocks', 9 );

Paramètres

Entrée :
$text, $num_words = 55, $more = null
Sortie :
@param int $number The maximum number of words. Default 55.
@param string $more_string The string shown within the more link.
@param string $text        The trimmed text.
@param string $raw_excerpt The text prior to trimming.
@param string $text      Text to trim.
@param int    $num_words Number of words. Default 55.
@param string $more      Optional. What to append if $text needs to be trimmed. Default '…'.
@return string Trimmed text.

Utilisation

// Utilisation de la fonction wp_trim_words
$result = wp_trim_words($text, $num_words = 55, $more = null);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...