Last active
August 29, 2015 14:27
-
-
Save charleyramm/68285073795caad70624 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Replicates WordPress function the_meta() but outputs dt and dd elements instead of li. | |
Wrap with <dd> tags in your template. | |
*/ | |
function cairnie_the_attributes() { | |
if ( $keys = get_post_custom_keys() ) { | |
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 "<dt><span class='post-meta-key'>$key</span></dt> <dd>$value</dd>\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment