Created
January 15, 2012 16:03
-
-
Save benbalter/1616264 to your computer and use it in GitHub Desktop.
Display Custom Fields
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
function content_filter( $content ) { | |
global $post; | |
$output = array(); | |
$taxs = get_taxonomies( array( 'object_type' => array( $post->post_type ) ) ); | |
foreach ( $taxs as $tax ) { | |
$tax = get_taxonomy( $tax ); | |
$terms = get_the_term_list( $post->ID, $tax->name, null, ', ' ); | |
$output[ $tax->labels->singular_name] = $terms; | |
} | |
$postmeta = get_post_custom( $post->ID ); | |
foreach ( $postmeta as $key => $value ) { | |
$key = apply_filters( 'cdbs_postmeta_key', $key, $value ); | |
$output[ $key ] = $value[0]; | |
} | |
ksort( $output ); | |
$content .= '<div class="postmeta">'; | |
foreach ( $output as $label => $value ) { | |
$content .= '<div class="postmeta-row">'; | |
$content .= '<div class="postmeta-label">' . $label . ':</div>'; | |
$content .= '<div class="postmeta-value">' . $value . '</div>'; | |
$content .= '</div>'; | |
} | |
$content .= '<div class="postmeta-row"> </div></div>'; | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment