-
AuthorPosts
-
August 2, 2021 at 7:48 pm #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, 4 months ago by christiemade.
August 5, 2021 at 10:50 am #1314600Hey 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,
IsmaelAugust 6, 2021 at 2:36 am #1314731Any 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.
August 11, 2021 at 4:28 am #1316166Hi,
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,
IsmaelAugust 12, 2021 at 2:50 am #1316337Yes, that does the trick! Thank you for following up. You can close this thread.
August 13, 2021 at 5:45 am #1316526 -
AuthorPosts
- The topic ‘Masonry Custom Image Source’ is closed to new replies.