I read the documentation, added the field and chose Image Object as the return value. I want to use this field to add header images on category pages in the Genesis Monochrome Pro theme.
This should work, but no image is showing up:
// get the current taxonomy term
$term = get_queried_object();
// vars
$image = get_field('category_featured_image', $term);
$caturl = $image['url'];
wp_localize_script( 'monochrome-backstretch-set', 'BackStretchImg', $caturl );
In the last line the variable $caturl should print the url to the image in the media library. Normally this is done by the theme like this:
$image = array( 'src' => has_post_thumbnail() ? genesis_get_image( array( 'format' => 'url' ) ) : '' );
wp_localize_script( 'monochrome-backstretch-set', 'BackStretchImg', $image );
So I replaced the first of these two lines to get the image from the custom field, but it is not working. Any idea why not?