• grape

    (@grape)


    Hi all, I need to keep the html formatting when using the post excerpt.
    Say in grid or list Post (Type)

    How can this be accomplished?
    I’m fine with adding code to my functions.php

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter grape

    (@grape)

    Doe anyone have any info that I could look into?
    I would just like for the excerpts to keep their styling and formatting.
    Is this possible (besides the custom excerpt?) I am trying to make this as easy on my client as possible.

    ANY HELP would be MUCH appreciated

    Plugin Contributor codersantosh

    (@codersantosh)

    Hello @grape ,
    You can use the filter hook gutentor_get_excerpt_by_id which you can find on functions.php#L215

    Can you try the following code:

    if ( ! function_exists( 'prefix_get_excerpt_with_format' ) ) {
        function prefix_get_excerpt_with_format( $the_excerpt, $post_id ) {
            $the_post     = get_post( $post_id );
            $the_excerpt  = $the_post->post_excerpt;
            return wp_kses_post($the_excerpt);
        }
    }
    add_filter('gutentor_get_excerpt_by_id','prefix_get_excerpt_with_format',10,2);

    Note: I have not tested the code.

    Let me know if this work for you.

    Best Regards!

    Thread Starter grape

    (@grape)

    Yea! thank you much! works like a charm

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Keep html formatting in excerpt’ is closed to new replies.