![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
-
AuthorPosts
-
March 11, 2020 at 4:00 pm #1192335
Hello,
I would like NOT to strip HTML tags for masonry elements. This seems to be possible with the new “avf_masonry_loop_entry_content” filter.
Could you please provide guidance about how to achieve this ?
Thanks
BérangèreMarch 12, 2020 at 3:00 am #1192459i did this before the new filter on having a child-theme : av-helper-masonry.php
and on line 627 i did :$loop_excerpt = $entry->post_excerpt;
but i do agree now it has to work with that new filterJuly 5, 2020 at 5:46 pm #1228055Here is the solution :
add_filter(‘avf_masonry_loop_entry_content’, ‘my_avf_masonry_loop_entry_content’, 10, 2);
function my_avf_masonry_loop_entry_content($loop_excerpt, $entry) {
$loop_excerpt=$entry->post_excerpt;
return $loop_excerpt;
}July 6, 2020 at 8:33 am #1228214Hi caudebert,
Great, I’m glad that you found a solution and thanks for sharing. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardJune 7, 2021 at 2:52 pm #1304427Hello,
I am taking over from a previous wenbmaster.
In fact the above solution does not work (I don’t kown whether it has ever worked),
HTML tags are still stripped : https://test.ethiopiatropicaltours.com/ethiopia-tours-history-culture/Can you please advise how to set up this filter so that HLML tags are not stripped in masonry excerpts ?
Thanks
ChristopheJune 9, 2021 at 4:20 am #1304774Hi,
Looks like you are using the Advance Layout Builder to build the content of the posts. The theme automatically strips all shortcodes when this is the case to make sure that the Masonry displays correctly. If you would like to change this, try to edit the enfold/config-templatebuilder/avia-shortcodes/av-helper-masonry.php file, look for this code around line 771.
$this->loop[ $key ]['content'] = avia_backend_truncate( $entry->post_content, apply_filters( 'avf_masonry_excerpt_length', 60 ), apply_filters( 'avf_masonry_excerpt_delimiter', ' ' ), '…', true, '' ); }
.. and replace it with:
$this->loop[ $key ]['content'] = $entry->post_content;
Let us know if it changes anything.
Best regards,
IsmaelJune 9, 2021 at 10:33 am #1304828Hello Ismael,
Seems that I have not been clear enough. Our need is to keep html tags in excerpts displayed on masonry grids.
We have already edited av-helper-masonry.php in a child theme, this way :
$loop_excerpt = strip_tags( $entry->post_excerpt );
replaced by :
$loop_excerpt = $entry->post_excerpt;It works well on our production site : https://ethiopiatropicaltours.com/ethiopia-tours-history-culture/
However we need to reapply this change for each major release. So we would prefer a robust solution with a filter.
Your change log mentions :
added: filter avf_masonry_loop_entry_content: allows to filter content (e.g. to allow/skip HTML tags)So we would like to knows how to use this filter in order NOT to strip html tags in excerpts, if possible.
Thanks,
ChristopheJune 9, 2021 at 1:39 pm #1304868i think your code works
try with copy pastefunction my_avf_masonry_loop_entry_content($loop_excerpt, $entry) { $loop_excerpt = $entry->post_excerpt; return $loop_excerpt; } add_filter('avf_masonry_loop_entry_content', 'my_avf_masonry_loop_entry_content', 10, 2);
June 9, 2021 at 1:55 pm #1304871Hi Guenni007,
I have already tried to enter this code in functions.php in my child theme, but it doesn’t work :-((June 9, 2021 at 5:07 pm #1304939The fact that I’m asking you to try copy&paste is that I can’t see from your posting if you used the correct quotation marks.
Unfortunately, far too few people on this forum use the code tag function.I tested it on a new installation and it works on my end.
June 9, 2021 at 5:54 pm #1304953Hi Guenni007,
You’re definitely right, I had made a typo and now it works !Too bad that the theme support recommends to edit the theme while they provide a robust solution :-((
Thanks a lot again,
ChristopheJune 11, 2021 at 7:00 am #1305205Hi,
Glad to know that @Guenni007 managed to provide a better solution. Please feel free to open another thread if you need anything else.
Have a nice day.
Best regards,
Ismael -
AuthorPosts
- The topic ‘New filter : avf_masonry_loop_entry_content’ is closed to new replies.