WordPress.org

Ready to get started?Download WordPress

Forums

Edit Flow
[resolved] Exporting Editorial Metadata (17 posts)

  1. Statmanlouie
    Member
    Posted 2 years ago #

    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/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Yep, the data is totally accessible. Can you post in Pastebin 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.

  3. Statmanlouie
    Member
    Posted 2 years ago #

    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

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Cool. Check out this code snippet and let me know if you have any questions about it. You should be able to modify it to your liking.

  5. Statmanlouie
    Member
    Posted 2 years ago #

    I dropped it in but it's only returning the text "Photo credit: "

    It's not exporting the value in the field.

  6. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    You'll need to modify the slug for the editorial metadata term to be whatever the slug is in your site.

  7. Statmanlouie
    Member
    Posted 2 years ago #

    I created one using the same slug (photo-credit) that you had in code snippet.

    Is it possible I'm missing another step?

  8. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    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.

  9. Statmanlouie
    Member
    Posted 2 years ago #

    Thanks, Daniel.

    I really appreciate your help and your time on this.

  10. schulte
    Member
    Posted 2 years ago #

    Messed around with this using the snippets but couldn't coax out the metadata. Rats.

  11. schulte
    Member
    Posted 2 years ago #

    Daniel -- could you revisit this one? I really need to be able to display that metadata in posts.

  12. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Yep, sorry. I'll try to take a look at this over the next week

  13. schulte
    Member
    Posted 2 years ago #

    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;
            }
  14. schulte
    Member
    Posted 2 years ago #

    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...

  15. Statmanlouie
    Member
    Posted 2 years ago #

    It works! Thank you so much for all your help, schulte and Daniel!

  16. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    I've flagged this as an issue to fix

  17. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    This should be doable now in v0.7.4

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic