• Resolved Nicklas

    (@blekfis)


    My theme, Restaurante from Templatic, is using this function:

    // Excerpt length
    function bm_better_excerpt($length, $ellipsis) {
    $text = get_the_content();
    $text = strip_tags($text);
    $text = substr($text, 0, $length);
    $text = substr($text, 0, strrpos($text, " "));
    $text = $text.$ellipsis;
    return $text;
    }

    My problem is that it sometimes writes shortcode in plain text on the archive page, example:

    Nu har vi en liten fin kaffemaskin ocks?! V?lkommen! [caption id=”attachment_3011″ align=”alignleft” …

    From: https://helensglutenfria.se/nyheter

    Is there a way to make sure it doesn’t cut off in the middle of a shortcode, or any other simple solution?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Nicklas

    (@blekfis)

    Where the function is used it says:
    <p><?php echo bm_better_excerpt(105, ‘… ‘); ?> </p>

    Tried increasing $length from 105 to 1500, but that just made it echo the full shortcode, so I need to find a solution that filters out shortcode

    Thread Starter Nicklas

    (@blekfis)

    Problem solved, just used the_excerpt(); instead

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode is shown, can it be removed?’ is closed to new replies.