Tagged: ,

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #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ère

    #1192459

    i 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 filter

    #1228055

    Here 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;
    }

    #1228214

    Hi 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,
    Rikard

    #1304427

    Hello,

    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
    Christophe

    #1304774

    Hi,

    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,
    Ismael

    #1304828

    Hello 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,
    Christophe

    #1304868

    i think your code works
    try with copy paste

    function 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);
    #1304871

    Hi Guenni007,
    I have already tried to enter this code in functions.php in my child theme, but it doesn’t work :-((

    #1304939

    The 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.

    #1304953

    Hi 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,
    Christophe

    #1305205

    Hi,

    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

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘New filter : avf_masonry_loop_entry_content’ is closed to new replies.