I’m using this in conjunction with the Custom Post Types UI plugin, have Custom Post Types UI set to ‘Supports Custom Fields,’ have added an image upload field to my page, and then inserted
<?php get_post_custom_values('img_upload'); ?>into my custom post type template. (img_upload being my custom field key)
However, the image isn’t appearing on the page. I’ve also attempted to try different field types, but those didn’t show up either.
I deactivated all of my plugin, still no result.
I tried switching themes, no result.
Tried it on a different site altogether and actually got a bunch of PHP errors.
Not sure if anyone else is having this experience, but for the life of me I can’t seem to fix it.
Any ideas would be awesome. Thanks!
You need to echo the value
<?php echo get_post_custom_values('img_upload'); ?>
and then really, you would want to echo it inside an image tag:
<img src="<?php echo get_post_custom_values('img_upload'); ?>">
something like that
Thanks for the response!
Unfortunately this plugin still doesn’t work for me.
<?php echo get_post_custom_values('img_upload'); ?>as well as
<img src="<?php echo get_post_custom_values('img_upload'); ?>">within the loop of my custom post type template to no avail.
I found that the following made it work;
Store array in a variable
<?php $img = get_post_custom_values('img_upload'); ?>
And then echo out the array as follows
<img src="<?php echo $img; ?>">
More on storing and outputting arrays can be found here
Also try this to keep it a one-liner:
<?php echo get_post_meta($post->ID, 'img_upload', true); ?>
The first parameter passes the current post/page ID, the second one is the name of the metakey you need, and the third is for whether or not you want to force it to return just a single value, instead of an array. (True = single value, false = array).
I’ve tried all the suggestions in this thread and none are working for me.
The image is uploaded, it shows up fine in the backend but in the frontend, I either see nothing or I get just a link to the image, such as with this code:
- The topic ‘[Plugin: Verve Meta Boxes] Custom Fields Content not Showing up’ is closed to new replies.