Title: Eric's Replies | WordPress.org

---

# Eric

  [  ](https://wordpress.org/support/users/eklemen2/)

 *   [Profile](https://wordpress.org/support/users/eklemen2/)
 *   [Topics Started](https://wordpress.org/support/users/eklemen2/topics/)
 *   [Replies Created](https://wordpress.org/support/users/eklemen2/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/eklemen2/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/eklemen2/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/eklemen2/engagements/)
 *   [Favorites](https://wordpress.org/support/users/eklemen2/favorites/)

 Search replies:

## Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Guest Author – How to display posts on /author archive page](https://wordpress.org/support/topic/guest-author-how-to-display-posts-on-author-archive-page/)
 *  Thread Starter [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/guest-author-how-to-display-posts-on-author-archive-page/#post-5706918)
 * I ended up going with the Co-Authors Plus plugin. It still was a bit challenging,
   but this plugin achieved all that I needed to: [https://wordpress.org/plugins/co-authors-plus/](https://wordpress.org/plugins/co-authors-plus/)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Co-Authors Plus] Really confused: Author vs. Co-Author](https://wordpress.org/support/topic/really-confused-author-vs-co-author/)
 *  Thread Starter [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/really-confused-author-vs-co-author/#post-5743456)
 * Through trial and error, I discovered the foreach loop was not needed on author.
   php archive page. A little more streamlined than my last comment.
 *     ```
       $this_author_display_name = get_the_author();
       if( get_the_author_meta( 'guest_author_title' ) ){
       	// account authors
       	$this_author_title = get_the_author_meta( 'guest_author_title' );
       } elseif( get_post_meta( $authorID, 'guest_author_title', true ) ){
       	// CAP guest author
       	$this_author_title = get_post_meta( $authorID, 'guest_author_title', true );
       }
       if( get_the_author_meta( 'email' ) ){
       	$this_author_email = get_the_author_meta( 'email' );
       }
       if( get_the_author_meta( 'guest_author_phone_number' ) ){
       	// account authors
       	$this_author_phone_number = get_the_author_meta( 'guest_author_phone_number' );
       } elseif( get_post_meta( $authorID, 'guest_author_phone_number', true ) ){
       	// CAP guest authors
       	$this_author_phone_number = get_post_meta( $authorID, 'guest_author_phone_number', true );
       }
       if( get_the_author_meta( 'guest_author_linkedin' ) ){
       	// account authors
       	$this_author_linkedin = get_the_author_meta( 'guest_author_linkedin' );
       } elseif( get_post_meta( $authorID, 'guest_author_linkedin', true ) ){
       	// CAP guest authors
       	$this_author_linkedin = get_post_meta( $authorID, 'guest_author_linkedin', true );
       }
       if( get_the_author_meta( 'guest_author_twitter' ) ){
       	// account authors
       	$this_author_twitter = get_the_author_meta( 'guest_author_twitter' );
       } elseif( get_post_meta( $authorID, 'guest_author_twitter', true ) ){
       	// CAP guest authors
       	$this_author_twitter = get_post_meta( $authorID, 'guest_author_twitter', true );
       }
       if( get_the_author_meta( 'description' ) ){
       	$this_author_description = get_the_author_meta( 'description' );
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Co-Authors Plus] Really confused: Author vs. Co-Author](https://wordpress.org/support/topic/really-confused-author-vs-co-author/)
 *  Thread Starter [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/really-confused-author-vs-co-author/#post-5743188)
 * P.S. This is what I ended up doing to the time being. It feels dirty. Is there
   a better way?
 *     ```
       // If there's a cleaner way to do this, I haven't found out how. The author data seems to be accessed differently for account-holding authors and non-account co-authors (created by co-authors plus plugin) when using custom fields (created by Advanced Custom Fields).
   
       // Default all author values to null
       $this_author_display_name = $this_author_title = $this_author_email = $this_author_phone_number = $this_author_linkedin = $this_author_twitter = $this_author_biography = null;
   
       // Co-Authors (non custom fields also return for account-holding authors)
       $coauthors = get_coauthors();
       foreach( $coauthors as $coauthor ){
       	$this_author_display_name = get_the_author();
       	if( get_post_meta( $coauthor->ID, 'guest_author_title', true ) ){
       		$this_author_title = get_post_meta( $coauthor->ID, 'guest_author_title', true );
       	}
       	if( $coauthor->user_email ){
       		$this_author_email = $coauthor->user_email;
       	}
       	if( get_post_meta( $coauthor->ID, 'guest_author_phone_number', true ) ){
       		$this_author_phone_number = get_post_meta( $coauthor->ID, 'guest_author_phone_number', true );
       	}
       	if( get_post_meta( $coauthor->ID, 'guest_author_linkedin', true ) ){
       		$this_author_linkedin = get_post_meta( $coauthor->ID, 'guest_author_linkedin', true );
       	}
       	if( get_post_meta( $coauthor->ID, 'guest_author_twitter', true ) ){
       		$this_author_twitter = get_post_meta( $coauthor->ID, 'guest_author_twitter', true );
       	}
       	if( $coauthor->description ){
       		$this_author_biography = $coauthor->description;
       	}
   
       }
   
       // Account Holding Authors (custom fields)
       if( get_the_author_meta( 'guest_author_title' ) ){
       	$this_author_title = get_the_author_meta( 'guest_author_title' );
       }
       if( get_the_author_meta( 'guest_author_phone_number' ) ){
       	$this_author_phone_number = get_the_author_meta( 'guest_author_phone_number' );
       }
       if( get_the_author_meta( 'guest_author_linkedin' ) ){
       	$this_author_linkedin = get_the_author_meta( 'guest_author_linkedin' );
       }
       if( get_the_author_meta( 'guest_author_twitter' ) ){
       	$this_author_twitter = get_the_author_meta( 'guest_author_twitter' );
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Co-Authors Plus] Really confused: Author vs. Co-Author](https://wordpress.org/support/topic/really-confused-author-vs-co-author/)
 *  Thread Starter [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/really-confused-author-vs-co-author/#post-5743139)
 * P.S. What I’m trying to do is create a custom author.php page that displays the
   same info for post authors (account holders) as co-authors (non-account holders).
 * Thanks again!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Co-Authors Plus] Guest author Biographical Info on author.php](https://wordpress.org/support/topic/guest-author-biographical-info-on-authorphp/)
 *  [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/guest-author-biographical-info-on-authorphp/#post-5455768)
 * This is not working for me.
 * On my author.php using Jeremy’s example above, I get the following results:
 *     ```
       $coauthors = get_coauthors();
       foreach( $coauthors as $coauthor ){
       	$userdata = get_userdata( $coauthor->ID );
       	var_dump( $userdata ); //returns bool(false)
       	if ( $userdata->display_name ) { //returns "Notice: Trying to get property of non-object"
       		echo '<h2>' . $userdata->display_name . '</h2>';
       	}
       }
       ```
   
 * Any ideas what I’m doing wrong?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Guest Author – How to display posts on /author archive page](https://wordpress.org/support/topic/guest-author-how-to-display-posts-on-author-archive-page/)
 *  Thread Starter [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/guest-author-how-to-display-posts-on-author-archive-page/#post-5706845)
 * **UPDATE**
 * I’m _kinda_ getting there. So far I’ve managed to write a custom author posts
   link if a guest author exists.
 * The resulting URL for a post author and guest author now have matching formats…
 * post author ex: [http://www.example.com/author/john-doe](http://www.example.com/author/john-doe)
   guest author ex: [http://www.example.com/author/jane-doe](http://www.example.com/author/jane-doe)
 * Now I just need to figure out how to hijack the author archive page to display
   posts from the post author OR the guest author.
 * **FUNCTIONS.PHP CODE:**
 *     ```
       add_filter( 'the_author_posts_link', 'custom_author_posts_link' );
   
       function custom_author_posts_link($url) {
   
       global $post;
   
       $post_object = get_field('post_author');
   
       if ( $post_object ) {
   
       // GUEST AUTHOR EXISTS - override post object to grab relevant guest author info
       global $post;
       $post = $post_object;
       setup_postdata( $post );
   
       $guest_author_slug = $post->post_name;
       $guest_author_name = get_field('team_member_name');
       $guest_author_posts_link = site_url() . '/author/' .  $guest_author_slug;
   
       $guest_url = sprintf(
           '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
           esc_url( $guest_author_posts_link ),
           esc_attr( sprintf( __( 'Posts by %s' ), $guest_author_name ) ),
           $guest_author_name
       );
   
       $guest_url = $link; 
   
       wp_reset_postdata(); // We're done here. Return to main $post object
   
       }
   
       return $url;
   
       }
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [String not returning from wp_query loop](https://wordpress.org/support/topic/string-not-returning-from-wp_query-loop/)
 *  Thread Starter [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/string-not-returning-from-wp_query-loop/#post-5688409)
 * I discovered my error wasn’t in the loop itself, but in how I was calling the
   function. Here’s how I correctly called the function:
 *     ```
       <?php
       $upcoming_events = the_merged_presentation_events(true);
       if( $upcoming_events !== false ){
       	echo '<h3>Upcoming Presentations</h3>';
       	echo $upcoming_events;
       }
       >
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Subfolder index.php 404 Errors](https://wordpress.org/support/topic/subfolder-indexphp-404-errors/)
 *  Thread Starter [Eric](https://wordpress.org/support/users/eklemen2/)
 * (@eklemen2)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/subfolder-indexphp-404-errors/#post-4571819)
 * These two examples are more accurate to my situation:
 * WORKS: [http://www.mydomain.com/parentpage/](http://www.mydomain.com/parentpage/)
   
   404 PAGE: [http://www.mydomain.com/parentpage/childpage/index.php](http://www.mydomain.com/parentpage/childpage/index.php)
 * WORKS: [http://www.mydomain.com/category/slug/](http://www.mydomain.com/category/slug/)
   
   404 PAGE: [http://www.mydomain.com/category/slug/index.php](http://www.mydomain.com/category/slug/index.php)

Viewing 8 replies - 1 through 8 (of 8 total)