Created
February 8, 2012 03:19
-
-
Save danielbachhuber/1764918 to your computer and use it in GitHub Desktop.
Get the editorial metadata value for a given term
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
<?php | |
/** | |
* Output the value for an editorial metadata term | |
* @see http://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata | |
*/ | |
function photo_credit() { | |
global $edit_flow; | |
// Don't cause any fatal errors if Edit Flow or editorial metadata are deactivated | |
if ( !is_object( $edit_flow ) || $edit_flow->helpers->module_enabled( 'editorial-metadata' ) ) | |
return; | |
// Get the editorial metadata term you want the postmeta value for by slug | |
$term = $edit_flow->editorial_metadata->get_editorial_metadata_term_by( 'slug', 'photo-credit' ); | |
// Get the postmeta value for the current post | |
$value = $edit_flow->editorial_metadata->get_postmeta_value( $term, get_queried_object_id() ); | |
// Echo the value | |
echo "Photo credit: " . $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment