Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1492379

    Hi, I’ve read 5+ old threads about adding HTML capabilities to the portfolio excerpt, but none of them work (possibly because the code isn’t relevant anymore).

    I would like to add bullets to all of my portfolio excerpts so that my masonry gallery on the homepage shows a bulleted list under each title — alternatively, if I can display the preview text which already allows HTML instead of the excerpt that would be an option as well.

    I manually added a bullet symbol (•) in front of each line item since

    • xxxx

    wasn’t working, but it doesn’t display correctly when the text takes up 2 lines.

    #1492392

    Hey sjahan,

    Thank you for the inquiry.

    Looks like you’re now using the Masonry element instead of the Portfolio Grid. Where can we find the Portfolio element? Please create a test page and provide screenshots so we can check this further.

    f5Y59dQ.md.png

    Best regards,
    Ismael

    #1492402

    on masonry – try:

    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);

    or maybe a bit stricter what is allowed (or better which is not influenced by strip_tags)

    function my_avf_masonry_loop_entry_content($loop_excerpt, $entry) {
      $loop_excerpt = strip_tags( ($entry->post_excerpt) , '<br><p><ul><li>'  );
      return $loop_excerpt;
    }
    add_filter('avf_masonry_loop_entry_content', 'my_avf_masonry_loop_entry_content', 10, 2);

    the point is that on the class-avia-masonry.php (or legacy inside: av-helper-masonry.php) the loop-excerpt is set to :
    $loop_excerpt = strip_tags( $entry->post_excerpt );

    #1492414

    Unfortunately, WordPress is very stubborn when it comes to automatically setting br tags. You could use the following in the excerpts:

    <strong>Validation & Calibration</strong>
    <ul>
    	<li>Supply and exhaust air volumes</li>
    	<li>Room pressure differential</li>
    	<li>Pressure gauges and monitors</li>
    	<li>Air changes per hour</li>
    	<li>Incubators and scales</li>
    	<li>Refrigerators and freezers</li>
    </ul>

    All my attempts to remove these automatic br tags failed. So you could just use it like this:

    <strong>Validation & Calibration</strong><ul><li>Supply and exhaust air volumes</li><li>Room pressure differential</li><li>Pressure gauges and monitors</li><li>Air changes per hour</li><li>Incubators and scales</li><li>Refrigerators and freezers</li></ul>

    see on “listpoints” post : https://webers-testseite.de/masonry-blog/

    #1492429

    Hi Ismael, sorry I called it the wrong thing. You are correct, I am using the masonry gallery for the portfolio entries. What’s currently on the homepage is accurate. This is a staging site so don’t worry about messing with anything. The bullets that you show in your screenshot are a result of the symbols I entered in the excerpt since the html tags weren’t working Portfolio Entry Excerpt
    (screenshot: https://imgur.com/a/iUmI9pS)
    Hi Guenni007, yes that’s what I had already attempted to do but it wasn’t working so that’s why I created the ticket. Thank you though!

    • This reply was modified 1 day, 23 hours ago by sjahan.
    #1492434

    and you have inserted that snippet to your child-theme functions.php:

    function my_avf_masonry_loop_entry_content($loop_excerpt, $entry) {
      $loop_excerpt = strip_tags( ($entry->post_excerpt) , '<br><p><ul><li>'  );
      return $loop_excerpt;
    }
    add_filter('avf_masonry_loop_entry_content', 'my_avf_masonry_loop_entry_content', 10, 2);

    But why does it work on my test page? And not on yours?

    PS
    you do not need the bullits on a ul li elemtent – it is allready there.

    PPS: where can i see the page you belong to. on https://aabc.com ?

    You now like not to use the masonry portfolio ?

    • This reply was modified 1 day, 19 hours ago by Guenni007.
    #1492452

    Hi,

    Thank you for the upate.

    The suggested snippets above should work. Please try adding this filter again in the functions.php file to retrieve the post excerpt without stripping the html tags.

    add_filter( 'avf_masonry_loop_entry_content', 'avf_masonry_loop_entry_content_mod', 10, 4 );
    
    function avf_masonry_loop_entry_content_mod( $loop_excerpt, $entry, $entries, $key ) {
        if ( ! empty( $entry->post_excerpt ) ) {
            return $entry->post_excerpt;
        }
    
        return $entry->post_content;
    }

    If this is not working, try this:

    add_filter( 'avf_masonry_entry_content', 'avf_masonry_entry_content_mod', 10, 3 );
    
    function avf_masonry_entry_content_mod( $content, $entry, $config ) {
        return $entry->post_excerpt;
    }

    Best regards,
    Ismael

    #1492469

    None of those codes work for me unfortunately. One of the codes just added extra spacing between the line items.

    The bullets that are displaying are only there because I manually added them in as text thinking that could be my workaround since the code wasn’t working, but it doesn’t look great when the text uses up 2 lines vs 1. (Sample:

  • • Room Pressure Differential
  • )

    For testing purposes I removed them from the “Certification” portfolio item. Ismael, would you be able to login and see if I’m doing something wrong? I’ve tried all the codes you and Guenni007 provided (1 at a time of course vs incorporating all of them).

#1492486

Hi,
When I check I see this:
fYxUerQ.md.png
Try this css in your Quick CSS field:

.portfolio .av-masonry-entry-content br {
	display: none;
}

The result:
fYxP7fa.md.png

Best regards,
Mike

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.