Support » Plugin: Gutenberg Blocks – Ultimate Addons for Gutenberg » Option to “Retain HTML format” in the excerpt of Post Grid and Post Masonry

  • Resolved Abu Maryam

    (@abu-maryam)


    Hello,

    first of all thank you all for this wonderful plugin.

    Is there a way to retain the HTML format in the excerpt of Post Grid and Post Masonry?
    I tried to use:

    add_filter('uagb_single_post_excerpt_grid', function($excerpt, $id, $attr) {
    	return get_the_content();
    },10, 3 );

    But with this way some HTML codes work fine and other codes likes <figure> and <embed> will be stripped. The problem with this code is also that the count of characters/words can not be controled.

    I also tried:

    add_filter('uagb_single_post_excerpt_grid', function($excerpt, $id, $attr) {
    	return the_content();
    },10, 3 );

    With this code all HTML will work fine but the problem is also that the count of characters/words can not be controled.

    Do you have any suggestion how I can retain the complete HTML format in the excerpt of Post Grid and Post Masonry? And at the same time to be able to controle the count of characters/words.

    • This topic was modified 8 months, 4 weeks ago by Abu Maryam.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hello @abu-maryam,

    If you want to retain the HTML format in the excerpt of Post Masonry, then you can use the following filter:

    add_filter('uagb_single_post_excerpt_masonry', function($excerpt, $id, $attr) {
    	return get_the_content();
    },10, 3 );

    If you want to retain the HTML format in the excerpt for Post Grid, then you can use the following filter:

    add_filter('uagb_single_post_excerpt_grid', function($excerpt, $id, $attr) {
    	return get_the_content();
    },10, 3 );

    Now, regarding your last query, unfortunately, this is not possible. You need to use the functions like wp_trim().

    I would suggest you to please refer to this link link

    I hope this helps.

    Regards,
    Sweta

    Sweta, thanks for your reply.

    As I mentioned, it would be really great to have the option to choose between showing the excerpt or the content. And also to retain the HTML format and to be able to control the count of words.

    Maybe in a future version you can extend the excerpt options in the Post grid and the Post Masonry…

    Today I found a plugin called Advanced Excerpt.
    Works fine for me now.

    Thanks!

    Greetings,
    Abu Maryam

    Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hello @abu-maryam,

    Yes. I would love to take this as a suggestion. I really like your example of how this particular feature would come in useful to the user. I have added your feature request to our to-do list, and we expect to roll it out in the near future.

    Thank you so much for your feedback and suggestion.

    Our team will try to find a solid solution to this and release it to our future updates.

    We really appreciate your efforts and patience.

    Thanks again for writing in and taking the time to provide your feedback.

    Regards,
    Sweta

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Option to “Retain HTML format” in the excerpt of Post Grid and Post Masonry’ is closed to new replies.