Support

Account

Home Forums General Issues Oxygen Builder and ACF Pro – Retrieving Images with Sizes

Unread

Oxygen Builder and ACF Pro – Retrieving Images with Sizes

  • Hello, I am using Oxygen Builder. Unfortunately, Oxygen’s ACF integration doesn’t allow you to retrieve fields from taxonomies. However, there is a workaround. By installing the Code Snippets plugin on your site and creating a snippet with the following code:

    function my_get_acf_taxonomy_field($acf_field) { global $wp_query; $cat_obj = $wp_query->get_queried_object(); $data = get_field($acf_field, $cat_obj->taxonomy.'_'.$cat_obj->term_id); return $data; }

    You can then edit your template in Oxygen and retrieve the custom fields using Insert Data > PHP Function Return Value (right at the bottom). You need to enter the function name my_get_acf_taxonomy_field and in the arguments box, enter the name of the ACF field that you want to retrieve. The ACF field is set to return the Image URL.

    HOWEVER…. I want to have control over the image sizes.

    I believe from another thread that the answer is perhaps touse the image id and use the WP function wp_get_attachment_image_src() or wp_get_attachment_image()

    I am a designer not a developer…. does anyone have the code snippet that would allow me to have control over the image sizes too? As I mentioned at the start I am using Oxygen Builder. Thank you in advance for any replies!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.