Images in radiobutton lookup

By: Roel Van Aelst | Asked: 07/24/2021
ForumsCategory: How-toImages in radiobutton lookup
Roel Van AelstRoel Van Aelst asked 3 years ago
Hi, I would like images to be displayed in a lookup field. The lookup field is has a radiobutton Display Type. In a normal radiobutton field, I can use the "Use images for options"-option, but this isn't available in a lookup...  How can I achieve the same look?
1 Answers
Chris Adams answered 3 years ago
Hi Roel In a normal radio button field when you choose the image option it adds an extra div directly after the <input> with the image source and an SVG icon. E.g.
<div class="frm_image_option_container">
<div class="frm_selected_checkmark">
<svg class="frmsvg"><use xlink:href="#frm_checkmark_circle_icon"></use></svg>
</div>
<img src="/wp-content/uploads/2021/02/iconfinder_face_Angry_evil_hatred_emoji_5241538.png" alt="Option 1" data-pagespeed-url-hash="1122291104" onload="pagespeed.CriticalImages.checkImageForCriticality(this);">
</div>
You could probably add that manually to a Lookup field set of radio buttons with jQuery or plain JS using a foreach loop and a list of your image URL's or it might be better to do it with PHP and the frm_setup_new_fields_vars hook or maybe the frm_filtered_lookup_options hook. Hope that helps.
Roel Van AelstRoel Van Aelst replied 3 years ago

Thanks for the reply! I've been trying to get this doen, but I don't think I can get this done. Could you help me (paid is possible ?)

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right