par
sirakawa » 12 mai 2012, 13:20
Le problème vient d'ailleurs que dans la fonction;
<?php
function improved_trim_excerpt($text) {
global $post;
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
$text = strip_tags($text, '<p><a><strong>
<font><h2><h3><span>');
$excerpt_length = 50;
$words = explode(' ', $text, $excerpt_length + 1); // $words est un tableau
if (count($words)> $excerpt_length) {
array_pop($words);
array_push($words, '[...]');
$text = implode(' ', $words); // ce n'est pas un tableau à ce niveau, mais une chaîne de caractères
}
}
}
// tu peux mettre pour te convaincre:
print "<br>texte dans la fonction $texte<==="; die();
return $text;
?>
Le problème vient d'ailleurs que dans la fonction;
<?php
function improved_trim_excerpt($text) {
global $post;
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
$text = strip_tags($text, '<p><a><strong>
<font><h2><h3><span>');
$excerpt_length = 50;
$words = explode(' ', $text, $excerpt_length + 1); // $words est un tableau
if (count($words)> $excerpt_length) {
array_pop($words);
array_push($words, '[...]');
$text = implode(' ', $words); // ce n'est pas un tableau à ce niveau, mais une chaîne de caractères
}
}
}
// tu peux mettre pour te convaincre:
print "<br>texte dans la fonction $texte<==="; die();
return $text;
?>