I need to make an accordion from arbitrary fields the_meta();
. But the standard call creates markup of this type:
<ul class='post-meta'> <li><span class='post-meta-key'>your_key:</span> your_value</li> <li><span class='post-meta-key'>your_key:</span> your_value</li> </ul>
That is, your_value
not highlighted by any tag that does not suit me. The very output of the the_meta();
function the_meta();
implemented in the file wp-includes/post-template.php
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"; } }
Edit this file also does not fit, so that when you upgrade does not fly away.
How to add a filter or action to wrap your_value
in a span
or p
?