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


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: