I'm using the new wordpress custom post types and fields.
It's all working great, but for a custom image field (where I can select multiple images in one field), the value of this field when output is an array:
<?php
$field = get_post_meta($post->ID, "puma", false);
echo $field[0];
?>
This results in the following output (there are 3 images here):
180|177|174
These are clearly the image ID's stored in the wp_posts table of the database.
However, before I go mad trying to do this manually via an SQL query (hack), I was wondering if there is a better and more native way in wordpress to get the value of these or the proper way to output these images?
Cheers, Michael.
EDIT:
Thanks to some help I got below, the final code for anybody who needs it is this:
<?php
$field = get_post_meta($post->ID, "myImageField", false);
$str = $field[0] . "|"; // add an extra pipe at the end to get ALL the items (kinda tricking it.
$theIDarray = explode('|', $str, -1);
foreach ($theIDarray as $value) {
echo wp_get_attachment_image($value, "myCustomImageSize");
}
?>
This works for a custom field with multiple image selections for the 'content-types-wordpress-plugin'. Hope it helps those in need!
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)