Order display of custom field meta
-
I am using the code below to display a list of custom field meta data, excluding the fields ‘CFimage’ and ‘description’.
It works as required except the order of the fields and values does not display consistently. I would like to display the field/value pairs in a specific order.
Can anyone please help me achieve this?
Thanks<?php if ( $keys = get_post_custom_keys() ) { echo "<ul class='post-meta'>\n"; foreach ( (array) $keys as $key ) { $keyt = trim($key); if ( '_' == $keyt{0} || 'CFimage' == $keyt || 'description' == $keyt ) $values = array_map('trim', get_post_custom_values($key)); $value = implode($values,', '); echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>", $key, $value); } echo "</ul>\n"; } ?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Order display of custom field meta’ is closed to new replies.