can you give more clue
write the loop part of the category page maybe
Pages don’t natively support excerpts. You need to add support for excerpts to Pages, if you want to use the_excerpt()
.
Try this, in functions.php
:
add_post_type_support( 'page', 'excerpt' );
Thread Starter
Filip
(@vladfilip)
hello, thank you for your answer… taht didn’t work either… i don’t know why… i managed to resolve this issue with copying a fragment of better excerpt plugin in functions.php:
add_option("better_excerpt_length", '250', '', 'yes');
add_option("better_excerpt_ellipsis", '...', '', 'yes');
add_option("better_excerpt_before_text", '<p>', '', 'yes');
add_option("better_excerpt_after_text", '</p>', '', 'yes');
add_option("better_excerpt_keep_line_breaks", '0', '', 'yes');
function get_options(){
$options = array();
$options['length'] = get_option(better_excerpt_length);
$options['ellipsis'] = get_option(better_excerpt_ellipsis);
$options['before_text'] = get_option(better_excerpt_before_text);
$options['after_text'] = get_option(better_excerpt_after_text);
return $options;
}
function better_excerpt($length, $ellipsis, $before_text, $after_text) {
$permalink = get_permalink($post->ID);
$text = get_the_content();
$text = preg_replace(" (\[.*?\])",'',$text);
if ($keep_line_breaks == 0) {
$text = strip_tags($text);
}
else {
$text = strip_tags($text, '<p><br>');
}
$text = substr($text, 0, $length);
$text = substr($text, 0, strripos($text, " "));
$text = trim(preg_replace( '/\s+/', ' ', $text));
$text = stripslashes($before_text).$text.$ellipsis;
$text .=stripslashes($after_text);
return $text;
}
function get_better_excerpt() {
$options = get_options();
extract($options);
return better_excerpt($length, $ellipsis, $before_text, $after_text);
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'get_better_excerpt');
and now it works…
Thank you again!