Title: [Plugin: Edit Flow] Exporting Editorial Metadata
Last modified: August 20, 2016

---

# [Plugin: Edit Flow] Exporting Editorial Metadata

 *  Resolved [Statmanlouie](https://wordpress.org/support/users/richjohnson_32/)
 * (@richjohnson_32)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/)
 * We are trying to figure out a solution to be able to export photo captions and
   credits that are stored in the editorial metadata.
 * We have a digital-first newsroom model, and as such the articles go online before
   in our printed publication. We use the Dirty Suds Export to InDesign plugin to
   export the information in the article into a text file in order to bring it into
   InDesign.
 * Now we need a place to store photo information like credits and captions.
 * I’ve been able to program it to also bring in the author and the title by using“
   the_title();” or “the_author();”
 * Does the Editorial Metadata have a similar command that can be used to call the
   fields to save them on the exported text files? I would like to use Editorial
   metadata to store that info, and it would be great to be able to export it as
   well.
 * [http://wordpress.org/extend/plugins/edit-flow/](http://wordpress.org/extend/plugins/edit-flow/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/page/2/?output_format=md)

 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545213)
 * Yep, the data is totally accessible. Can you post in [Pastebin](http://pastebin.com/)
   or similar the code you’ve written to create the export template? I can give 
   feedback on how to incorporate your editorial metadata into it.
 *  Thread Starter [Statmanlouie](https://wordpress.org/support/users/richjohnson_32/)
 * (@richjohnson_32)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545247)
 * Daniel,
 * Thanks for the response and your help.
 * Here is the code from the plugin’s taggedtext.php file.
 * The parts I have added are the functions to echo the headline and the author,
   as well as the parts calling “the_title();” or “the_author();”
 * [http://pastebin.com/d0XRFRAL](http://pastebin.com/d0XRFRAL)
 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545310)
 * Cool. Check out [this code snippet](https://gist.github.com/1764918) and let 
   me know if you have any questions about it. You should be able to modify it to
   your liking.
 *  Thread Starter [Statmanlouie](https://wordpress.org/support/users/richjohnson_32/)
 * (@richjohnson_32)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545311)
 * I dropped it in but it’s only returning the text “Photo credit: ”
 * It’s not exporting the value in the field.
 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545313)
 * You’ll need to modify the slug for the editorial metadata term to be whatever
   the slug is in your site.
 *  Thread Starter [Statmanlouie](https://wordpress.org/support/users/richjohnson_32/)
 * (@richjohnson_32)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545314)
 * I created one using the same slug (photo-credit) that you had in code snippet.
 * Is it possible I’m missing another step?
 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545326)
 * It’s buggy on my end too 🙁 So much for not testing my code. I’ll figure out 
   why it doesn’t work and get back to you.
 *  Thread Starter [Statmanlouie](https://wordpress.org/support/users/richjohnson_32/)
 * (@richjohnson_32)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545334)
 * Thanks, Daniel.
 * I really appreciate your help and your time on this.
 *  [schulte](https://wordpress.org/support/users/schulte/)
 * (@schulte)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545348)
 * Messed around with this using the snippets but couldn’t coax out the metadata.
   Rats.
 *  [schulte](https://wordpress.org/support/users/schulte/)
 * (@schulte)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545373)
 * Daniel — could you revisit this one? I really need to be able to display that
   metadata in posts.
 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545374)
 * Yep, sorry. I’ll try to take a look at this over the next week
 *  [schulte](https://wordpress.org/support/users/schulte/)
 * (@schulte)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545375)
 * So I looked in the database table and found that I could extract the correct 
   metadata for **assignment** using:
 *     ```
       $test = get_metadata( 'post', 177, '_ef_editorial_meta_paragraph_assignment', true );
       echo $test;
       ```
   
 * Provided I’m doing this right, trying the following:
 *     ```
       $term = $edit_flow->editorial_metadata->get_postmeta_key( 'assignment' );
       echo '$term;
       ```
   
 * yielded:
 * `_ef_editorial_meta__assignment`
 * Notice that the ‘paragraph’ is missing? Either I implemented _get\_postmeta\_key_
   incorrectly or that function isn’t adding the appropriate _$type_ to the _$prefix_.
 *     ```
       function get_postmeta_key( $term ) {
                       $key = self::metadata_postmeta_key;
                       $type = $term->type;
                       $prefix = "{$key}_{$type}";
                       $postmeta_key = "{$prefix}_" . ( is_object( $term ) ? $term->slug : $term );
                       return $postmeta_key;
               }
       ```
   
 *  [schulte](https://wordpress.org/support/users/schulte/)
 * (@schulte)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545376)
 * Talk about clunky but I think I got something basic working.
 * Added to **functions.php**:
 *     ```
       function view_editorial_metadata($slug, $type) {
           global $post, $edit_flow;
   
           $postmeta_key = "_ef_editorial_meta_{$type}_$slug";
   
           $view = get_metadata( 'post', $post->ID, '', true );
           $show_editorial_metadata = $view["{$postmeta_key}"][0];
   
           if ($type == "date") { $show_editorial_metadata = date("F j, Y", $show_editorial_metadata); }
   
           return $show_editorial_metadata;
       }
       ```
   
 * Example function calls:
 *     ```
       echo 'Assignment: ' . view_editorial_metadata('assignment','paragraph');
       echo view_editorial_metadata('first-draft-date','date');
       ```
   
 * You just have to know the editorial metadata slug and type beforehand…
 *  Thread Starter [Statmanlouie](https://wordpress.org/support/users/richjohnson_32/)
 * (@richjohnson_32)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545377)
 * It works! Thank you so much for all your help, schulte and Daniel!
 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [14 years ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/#post-2545390)
 * I’ve flagged this as an [issue to fix](https://github.com/danielbachhuber/Edit-Flow/issues/83)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/page/2/?output_format=md)

The topic ‘[Plugin: Edit Flow] Exporting Editorial Metadata’ is closed to new replies.

 * ![](https://ps.w.org/edit-flow/assets/icon-256x256.png?rev=3433533)
 * [Edit Flow](https://wordpress.org/plugins/edit-flow/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/edit-flow/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/edit-flow/)
 * [Active Topics](https://wordpress.org/support/plugin/edit-flow/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/edit-flow/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/edit-flow/reviews/)

## Tags

 * [bug reports](https://wordpress.org/support/topic-tag/bug-reports/)

 * 16 replies
 * 3 participants
 * Last reply from: [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/plugin-edit-flow-exporting-editorial-metadata/page/2/#post-2545412)
 * Status: resolved