Hey Grayzee,
This is not in response to your question, but I was just wondering if you are having any issues with the the dynamic preview. I can’t seem to make the preview match the front end. Front end is fine, but the preview is distorted. Seems like it is mainly the fonts.
Thanks, Rob
Hi @robswebdev
I have not really had much luck with the dynamic preview. My themes css is written in sass and compiled on the fly using gulp so it didn’t seem worth using.
I was planning on writing some php that auto assigns my module images to the wp back end to give some visuals when editing a page. They would how ever be static but would be enough for users to know what blocks they are editing.
I did think about changing my themes setup so each module had its own gulp setup but never got round to that either.
Sorry for the not very helpful response.
Graeme
Hello @grayzee,
You will find filters in the FAQ that will allow you to hardcode thumbnails for each layouts:
// add_filter('acfe/flexible/thumbnail/name=my_flexible', 'acf_flexible_layout_thumbnail', 10, 3);
// add_filter('acfe/flexible/thumbnail/key=field_xxxxxx', 'acf_flexible_layout_thumbnail', 10, 3);
// add_filter('acfe/flexible/layout/thumbnail/name=my_flexible&layout=my_layout', 'acf_flexible_layout_thumbnail', 10, 3);
// add_filter('acfe/flexible/layout/thumbnail/key=field_xxxxxx&layout=my_layout', 'acf_flexible_layout_thumbnail', 10, 3);
add_filter('acfe/flexible/layout/thumbnail/layout=my_layout', 'acf_flexible_layout_thumbnail', 10, 3);
function acf_flexible_layout_thumbnail($thumbnail, $field, $layout){
// Must return an URL or Attachment ID
return 'https://www.example.com/my-image.jpg';
}
You can target specific layout, or even all layouts from specific flexible content fields. Also, remember: you must return an url (relative/absolute) or an attachment ID.
Hope it helps 🙂
Have a good day!
PS: @robswebdev I’ll answer to your question on your topic.
PERFECT!!! Thanks for the help, Worked a treat.
Hello,
I’m glad to hear it! By the way, if you enjoy this plugin, feel free to add a review, it always helps 🙂
Have a nice day!
Regards.
Sweet lord what a great plugin, and this filter is exactly what I was looking for. Amazing work!