WordPress.org

Support

Support » Plugins and Hacks » Edit Flow » [Resolved] [Plugin: Edit Flow] Exporting Editorial Metadata

[Resolved] [Plugin: Edit Flow] Exporting Editorial Metadata

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Daniel Bachhuber

    @danielbachhuber

    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.

    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

    Plugin Author Daniel Bachhuber

    @danielbachhuber

    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.

    I dropped it in but it’s only returning the text “Photo credit: ”

    It’s not exporting the value in the field.

    Plugin Author Daniel Bachhuber

    @danielbachhuber

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

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

    Is it possible I’m missing another step?

    Plugin Author Daniel Bachhuber

    @danielbachhuber

    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.

    Thanks, Daniel.

    I really appreciate your help and your time on this.

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

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

    Plugin Author Daniel Bachhuber

    @danielbachhuber

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

    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;
            }

    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…

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

    Plugin Author Daniel Bachhuber

    @danielbachhuber

    I’ve flagged this as an issue to fix

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] [Plugin: Edit Flow] Exporting Editorial Metadata’ is closed to new replies.
Skip to toolbar