Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
Created February 8, 2012 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/1764918 to your computer and use it in GitHub Desktop.
Save danielbachhuber/1764918 to your computer and use it in GitHub Desktop.
Get the editorial metadata value for a given term
<?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