Using get_post_custom_values
-
Hi there.
I am trying to build a function in my theme which collects post metadata and displays them, according to what I write in the custom field. I want to show images representing flags (for countries). Some posts must have more than one flag displayed.
I thought the function get_post_custom_values would be nice.<?php get_post_custom_values($key, $post_id); ?> in my theme where I want the images to show up. For each post I create a custom field named flags, and type in values like uk,dk (etc).
And this script to associate metadata to images:
<? php
$uk=/images/uk-png;
$dk=/images/denmark.png;$mykey_values = get_post_custom_values(‘flags’);
Foreach ($mykey_values as $key => $value) {
echo “$key => $value (‘flags’)”;
}
?>But it doesnt work. Any hints?
- The topic ‘Using get_post_custom_values’ is closed to new replies.