28th April 2012, 16:31
#4
1 out of 1 members found this post helpful.
Cod:
function custom_excerpt() {
$maxim=100;
$output = substr(get_the_excerpt(),0,$maxim);
return $output;
}
add_filter('the_excerpt_rss', 'custom_excerpt' );
functioneaza, doar ca nu poti sa te limitezi in functie de cuvinte
28th April 2012, 18:03
#5
1 out of 1 members found this post helpful.
Se poate folosi wp_trim_words in loc de substr.
28th April 2012, 19:21
#7
1 out of 1 members found this post helpful.
wp_trim_words limiteaza numarul de cuvinte (substr limiteaza numarul de caractere) iar sintaxa e asemanatoare $output = wp_trim_words(get_the_excerpt(), $maxim);
Ca sa afisezi si imaginile banuiesc ca poti pastra codul lui @cyolan si sa inlocuiesti get_the_excerpt() cu get_the_content().
Ultima modificare făcută de Andrei Luca; 28th April 2012 la 19:35.