Really confused: Author vs. Co-Author
-
For Co-Authors Plus, I’d really find some examples of the following very helpful:
- How to get meta data from co-author vs. post author
- How to get custom field data from co-author vs. post author
- How to get custom field data from co-author vs. post author using Advanced Custom Fields
I’m confused how easy Co-Authors Plus should make this. Should I be able to write it one way and retrieve the same data no matter the author type? I find myself having to write it different ways what I’ve been testing:
// Guest Authors $coauthors = get_coauthors(); foreach( $coauthors as $coauthor ){ $guest_author_photo = get_field('guest_author_photo'); if ( !empty($guest_author_photo) ) { echo '<img src="' . $guest_author_photo['url'] . '" alt="' . $guest_author_photo['alt'] . '" /><br>'; } echo 'full name: ' . $coauthor->display_name . '<br>'; echo 'title: ' . get_post_meta( $coauthor->ID, 'guest_author_title', true ) . '<br>'; echo 'email: ' . $coauthor->user_email . '<br>'; echo 'phone number: ' . get_post_meta( $coauthor->ID, 'guest_author_phone_number', true ) . '<br>'; echo 'linkedin: ' . get_post_meta( $coauthor->ID, 'guest_author_linkedin', true ) . '<br>'; echo 'twitter: ' . get_post_meta( $coauthor->ID, 'guest_author_twitter', true ) . '<br>'; echo 'biography: ' . $coauthor->description . '<br>'; echo('</pre>'); } // Account Holding Authors echo 'title: ' . get_the_author_meta( 'guest_author_title' ) . '<br>'; echo 'phone number: ' . get_the_author_meta( 'guest_author_phone_number' ) . '<br>'; echo 'linkedin: ' . get_the_author_meta( 'guest_author_linkedin' ) . '<br>'; echo 'twitter: ' . get_the_author_meta( 'twitter' ) . '<br>';
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Really confused: Author vs. Co-Author’ is closed to new replies.