Here is the code that worked. I had to get rid of the foreach loop and reference the array directly:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$productimgs = get_post_meta( $post->ID, 'productimg', true );
$image_color = $productimgs[0]['product-image-color'];
$image_bw = $productimgs[0]['product-image-bw'];
$imgclr = wp_get_attachment_image_src( $image_color, 'grid-large' );
$imgbw = wp_get_attachment_image_src( $image_bw, 'grid-large' );
echo '<li>';
echo '<a href="' . get_permalink () . '"><img class="desat" src="' . $imgbw[0] . '" />';
echo '<img class="sat" src="' . $imgclr[0] . '" /></a>';
echo '</li>';
?>
Related Posts:
- Remove Dimension from wp_get_attachment_image
- Change wp_get_attachment_image attributes (src and srcset) on specific custom field
- How do I make a custom field choose an image?
- Extend WP Customizer to make multiple image selection possible
- Add multiple images to a page sidebar
- Display thumbnail from custom field
- Add custom field to image editor
- Display info from custom fields in all images’ HTML
- automatically set “Featured Image” the same as the og:i that is set in a custom field
- copy attachments to another post type and change attachment url
- limit amount of photos uploaded per cpt post
- Metabox with multiple fields added by user and upload box
- Add WYSIWYG to Image Description field
- Get Meta from Custom Field of Image URL
- Add url from Custom Field as ‘Featured Image’. Code not working
- How to display multiple images in custom field
- How to add image attachment to post from a single meta key (Woocommerce)
- Exclude images uploaded via meta boxes from WordPress gallery
- How to add the image URL from an external RSS feed and insert into a custom field?
- Add new image block, set default class name and update it using Javascript
- Better way to save image in custom field
- How do I add an image upload, custom field to a WooCommerce product?
- For homepage images (for small business website), is it better to use custom fields or post_thumbnail?
- Select multiple images from custom field
- Displaying page image in the footer automatically
- Get image url using image id
- Show image if author meta (profile fields) exists outside loop
- Convert attachment ID into url?
- Custom field as featured image caption
- Display a different image for each page with editor
- Image upload and path to custom field
- How to get custom image field of specific post id
- Selectively hiding or allowing thumbnails of featured images on front page
- wp_get_attachment_image_src() with advanced custom fields returning empty
- Unable to select image with custom field
- Users uploaded image and matching an id or taxonomy
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- Show image depending on the number in the custom fields
- How to delete attachments associated with custom field type when post property changes? [closed]
- Use a different catalog image than the featured image
- How to add custom fields to images for image source text and URL
- Get first URL from custom field, download and set as featured image on post publish
- Change path to child of page when uploading image via custom field
- Analyze uploaded images to get colour values
- Adding thumbnails for non-image attachments
- Upload image to wordpress
- Undefined Variable (Displaying image via custom field)
- Multiple image uploader under editor?
- Add image custom attribute [closed]
- How to mark a image attachment as background image?
- Crop custom image size vs actual size
- How can I add an image upload field directly to a custom write panel?
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- Add custom fields to search
- extend Meta Box / Document Panel
- getEntityRecord without knowing the post type
- ajax delete value from custom field array
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Custom field for default gallery
- How can I query on the year part of a complete date in a custom field?
- WordPress Custom Field Should be Unique. Is it possible?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- How to display Meta Field Value?
- What is the cleanest way to extract custom variables from a post
- Add source URL from Feed WordPress (Syndication) plugin to a custom field in post editor
- List custom taxonomy terms from custom field
- How do I create a column in Users list and display user data from custom registration field
- Remove Body Classes
- Product Custom Fields with HTML and JS
- Button inside Custom Meta Box triggering the Update Button
- wordpress custom loop ascending descending posts by custom field
- Only show when content added via custom field
- Using a custom field inside a shortocde
- Add Custom Profile Field as Notes
- Woocommerce frontend edit custom fields
- Add specific custom fields to post formats
- Displaying an ACF list of users
- wp_editor on custom meta textarea field – images and html fails
- using custom fields on content.php file of my theme
- Hide / Show Custom field depending of the page ID (Magic Field 2)
- How to show certain data on certain interval of period
- How to parse a huge list of users using a CRON function?
- Counting post fields
- add_comment_meta not working properly
- how to enable custom fields in the Gutenberg post editor
- Missing Custom Fields
- Automatically Add Tags Taxonomy in Post from Custom field’s value
- Is there any way to make a custom field for a post only if the author is a certain user?
- How to I change the value of a custom field on the home page?
- Stop truncation of shortcodes in custom text fields?
- Save custom post data outside of default post form
- Get custom field outside wordpress loop on new php page
- Wrap this custom field with hyperlink link
- Retrieve IDs from custom field, count and display results differently according to count
- How do i output images from URL’s added to the same custom field key
- Add Custom field under the post title [closed]
- Filter Query Post by Custom Fields(by date)
- Can’t sort custom column on user.php by number / meta_value_num?
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?