add_filter('excerpt_length', function(){
// Для постов с рубрикой 1
if (in_category(1)) {
return 100;
}
// Для постов с рубрикой 2
if (in_category(2)) {
return 50;
}
// Значение по умолчанию
return 25;
});
$post = get_post( $id );
echo apply_filters( 'the_content', $post->post_content );