Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1313984

    I have a page that uses masonry. Using filters, i’ve got which image is used overwritten (instead of featured image, it uses a custom field).
    The latest version of Enfold breaks this functionality.
    Enfold loads these images differently now (I can’t figure out how), so changing my source now just causes the images not to load at all.

    The code that used to work:

    function fp_attorney_masonry_display($content, $entries) {
              
      // Custom - Define the attachment as the custom photo field
      $photo_attach_id = get_field('photo',$content['ID']);
      
      $content['thumb_ID'] = $photo_attach_id['ID'];
      
      $img_size = "full";
      
      $content['attachment'] = !empty( $content['thumb_ID'] ) ? wp_get_attachment_image_src( $content['thumb_ID'], $img_size ) : '';
      
      return $content;
    }
    add_filter('avf_masonry_loop_prepare','fp_attorney_masonry_display', 10, 2);
    • This topic was modified 3 years, 3 months ago by christiemade.
    #1314600

    Hey Christie,

    Thank you for the inquiry.

    The filter above is not working because the background image is now applied using an internal style, which is generated by the get_element_styles function in the enfold/config-templatebuilder/avia-shortcodes/av-helper-masonry.php file. You may need to temporarily add the modification in the shortcode file instead of using the filter.

    Best regards,
    Ismael

    #1314731

    Any direction on how I would make this change? I’ve tried modifying where the thumb id is defined directly in av-helper-masonry.php with the same results.

    #1316166

    Hi,

    Sorry for the delay. We tested the filter in the our own installation and found out that it is not working because the attachment_overlay parameter is empty. We adjusted it a bit to fix the issue.

    function fp_attorney_masonry_display($content, $entries) {    
      // Custom - Define the attachment as the custom photo field
      $photo_attach_id = get_field('photo',$content['ID']);
    
      $content['thumb_ID'] = $photo_attach_id['ID'];
    
      $img_size = "full";
    
      $content['attachment'] = !empty( $content['thumb_ID'] ) ? wp_get_attachment_image_src( $content['thumb_ID'], $img_size ) : '';
      $content['attachment_overlay'] = $content['attachment'];
    
      return $content;
    }
    add_filter('avf_masonry_loop_prepare','fp_attorney_masonry_display', 10, 2)

    Best regards,
    Ismael

    #1316337

    Yes, that does the trick! Thank you for following up. You can close this thread.

    #1316526

    Hi,

    Great, I’m glad that Ismael could help you out, and thanks for the update. I’ll go ahead and close this thread for now then, please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Masonry Custom Image Source’ is closed to new replies.