public
Created

Get the editorial metadata value for a given term

  • Download Gist
gistfile1.aw
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?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;
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.