get_post_meta with array for multiple custom values for a single key
-
I’m trying to build an online portfolio using the Flutter plugin. I have a duplicate group on a page that has two fields,
portfolio-image-medium
andportfolio-image-large
. These are for the two different sizes the images will be (no way!). Displaying this using Flutter is pretty infuriating, so I’m trying to do this with get_post_meta and calling on each duplicate from the array. All of the images viaportfolio-image-medium
should display underdiv class="portfolioimages"
with links to its respectiveportfolio-image-large
.What I have now (below) works, but it isn’t exactly what I want, as I don’t think it’s optimized as well as it could be. For example, I don’t know how to call the same
portfolio-image-large
as theportfolio-image-medium
it relates to. I know this is probably some sort of count in the array and keeping it consistent, but I’m having a brain fart in terms of what I need to do. The code below just calls onportfolio-image-medium
and modifies it via Flutter, so it doesn’t useportfolio-image-large
at all. I’d like to change that. Any help is appreciated. Thanks!<?php $portimgmed = get_post_meta($cchild->ID, 'portfolio-image-medium', false); $portimglrg = get_post_meta($cchild->ID, 'portfolio-image-large', false); ?> <div class="portfolioitem" id="<?php echo $portslug; ?>"> <div class="portfolioimages"> <?php foreach ($portimgmed as $mediumimage) { $largeimage = get_post_meta($cchild->ID, 'portfolio-image-large', true); $count++; ?> <div class="portfolioimage"> <a href="<?php echo pt(); ?>?src=/evanmannweiler.com/wp-content/files_flutter/<?php echo $mediumimage; ?>&w=800" class="fancybox"><img src="<?php echo pt(); ?>?src=/evanmannweiler.com/wp-content/files_flutter/<?php echo $mediumimage; ?>&w=323&bg=fffaef" alt="" /></a> </div> <?php }; ?>
- The topic ‘get_post_meta with array for multiple custom values for a single key’ is closed to new replies.