customising custom field format
-
Hi basically i need to override the code below in funcitons php
/** * Display list of post custom fields. * * @internal This will probably change at some point... * @since 1.2.0 * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters. */ function the_meta() { if ( $keys = get_post_custom_keys() ) { echo "<ul class='post-meta'>\n"; foreach ( (array) $keys as $key ) { $keyt = trim($key); if ( is_protected_meta( $keyt, 'post' ) ) continue; $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>\n", $key, $value); } echo "</ul>\n"; } }i know it involves add_filter or something but when i do this:
add_filter('the_meta_key', 'modified_meta_matt', $priority = 1, $accepted_args = 1 ); function modified_meta_matt() { if ( $keys = get_post_custom_keys() ) { echo "<ul class='post-meta'>\n"; foreach ( (array) $keys as $key ) { $keyt = trim($key); if ( is_protected_meta( $keyt, 'post' ) ) continue; $values = array_map('trim', get_post_custom_values($key)); $value = implode($values,', '); echo apply_filters('modified_meta_matt', "<li><span class='post-meta-key-3'>$key:</span> $value</li>\n", $key, $value); } echo "</ul>\n"; } } ?>It does work, but it displays the custom fields repeated like 6 times!
thanks for your help!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘customising custom field format’ is closed to new replies.