• Resolved angie

    (@angie77)


    hi, hope this finds you well!

    i was wondering how can i externally call all multiple author’s names from an article into a modal (a pop up that can be trigered from any single post page by user’s click) that shows a brief from the article.

    something like:
    echo get_the_author_meta(‘first_name’, $author_id);
    or echo get_the_title(); – which i’m already successfully using to show the article’s title.

    i see publishpress author’s field has slugs foreach field, but i’m not being able to figure out the twirk (:

    thanks for the plugin!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Hi @angie77

    Thanks for using PublishPress Authors.

    This snippet should be helpful for your case: https://gist.github.com/ojopaul/c55a53228a3bd9dd7b7bed76726ca583

    Let me know if you have any issues.

    Thanks,

    Thread Starter angie

    (@angie77)

    hi @rizaardiyanto,
    thanks for the reply.

    i might be calling it wrong, but this snippet returned only the first author..
    how should i call it to be shown, please?

    then i tryed using the shortcode:
    echo do_shortcode( ‘[publishpress_authors_data field=”last_name”], echo do_shortcode( ‘[publishpress_authors_data field=”fisrt_name”]

    and now i’m geting all author’s from the post last name, then all author’s from the post fist name.

    thoughts? (:

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    @angie77 Can you share the code that you use? It should loop all the authors.

    Also share what your expectation output.

    Thanks,

    Plugin Author Steve Burge

    (@stevejburge)

    Thanks for using PublishPress. We’ve not hear back from you in over a week, so we’re closing this ticket for now. Please follow up if you can share more details.

    Thread Starter angie

    (@angie77)

    @rizaardiyanto sorry for the delay!

    – expectation output (let’s say there’s 3 authors added for a post):
    autor1-last-name, autor1-first-name. autor2-last-name, autor2-first-name. autor3-last-name, autor3-first-name.

    – the code i’m using (based on your suggestion: https://gist.github.com/ojopaul/c55a53228a3bd9dd7b7bed76726ca583):
    \?
    if (function_exists(‘publishpress_authors_get_post_authors’)) {
    $post_id = get_the_ID();
    $post_authors = publishpress_authors_get_post_authors($post_id);
    foreach ($post_authors as $post_author) {
    $first_name = $post_author->first_name;
    $last_name = $post_author->last_name;
    }
    }
    ?\
    \? php echo $last_name; ?\ \? php echo $first_name; ?\

    obs: i’ve changed the php < for \ here (:

    thanks!

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    @angie77 I corrected your code and this below code should work for your case:

    <?php
    if (function_exists('publishpress_authors_get_post_authors')) {
        $post_id = get_the_ID();
        $post_authors = publishpress_authors_get_post_authors($post_id);
        foreach ($post_authors as $post_author) {
            $first_name = $post_author->first_name;
            $last_name = $post_author->last_name;
            echo "$last_name, $first_name ";
        }
    }
    ?>

    Let me know if the issue persists.

    Thread Starter angie

    (@angie77)

    ohhh my, just a simple mistake.. ):
    thank you so much!
    twirk done perfectly.

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    @angie77 I’m glad to hear that ??

    We appreciate you using our plugin.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘externaly call all multiple author’s names from an article’ is closed to new replies.