get_post_custom_values not working in wordpress


Some times get_post_custom_values not work for direct array at that time we have to use foreach loop like below.

<?php
$mykey_values = get_post_custom_values(‘Designation’, $post->ID);
if(is_array($mykey_values)):
foreach ( $mykey_values as $key => $value ) {
echo “($value km)”;
}
endif;
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s