Skip to content

Instantly share code, notes, and snippets.

@charleyramm
Last active August 29, 2015 14:27
Show Gist options
  • Save charleyramm/68285073795caad70624 to your computer and use it in GitHub Desktop.
Save charleyramm/68285073795caad70624 to your computer and use it in GitHub Desktop.
/*
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