Show post excerpt

I want to show several post excerpt, so I create function

function my_excerpt($limit) {
    $excerpt = explode(' ', get_the_excerpt(), $limit);
    if (count($excerpt)>=$limit) {
        $excerpt = implode(" ",$excerpt).'...';
    } else {
        $excerpt = implode(" ",$excerpt);
    $excerpt = preg_replace('`[[^]]*]`','',$excerpt);
    return $excerpt;

and I use it:

<?php  echo bereza_excerpt(35); ?>

but I have problem – I cant save post formatting.

Is it possible to recreate this function and save text formatting in post excerpt?

Read more here: Show post excerpt

Leave a Reply

Your email address will not be published. Required fields are marked *