Skip to content

Commit

Permalink
Merge pull request #535 from jacobarriola/patch-1
Browse files Browse the repository at this point in the history
🐛Only filter author template for title
  • Loading branch information
rebeccahum authored Jun 25, 2018
2 parents b0c2871 + ab422f7 commit 7f3651a
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -1595,16 +1595,26 @@ public function clear_cache_on_terms_set( $object_id, $terms, $tt_ids, $taxonomy

}

/**
* Filter of the header of author archive pages to correctly display author.
*/
public function filter_author_archive_title() {
if ( is_author() ) {
$author_slug = sanitize_user( get_query_var( 'author_name' ) );
$author = $this->get_coauthor_by( 'user_nicename', $author_slug );
return sprintf( __( 'Author: %s' ), $author->display_name );
}
}
/**
* Filter of the header of author archive pages to correctly display author.
*
* @param $title string Archive Page Title
*
* @return string Archive Page Title
*/
public function filter_author_archive_title( $title ) {

// Bail if not an author archive template
if ( ! is_author() ) {
return $title;
}

$author_slug = sanitize_user( get_query_var( 'author_name' ) );
$author = $this->get_coauthor_by( 'user_nicename', $author_slug );

return sprintf( __( 'Author: %s' ), $author->display_name );
}

}

global $coauthors_plus;
Expand Down

3 comments on commit 7f3651a

@morganisok
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rebeccahum This code isn't what is actually in the current version of Co-Authors Plus, so archive titles are currently broken in the plugin. Will this be in the next version?

@rebeccahum
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wpalchemist Hi there! Thanks for asking. Yes, this should be included in the next release.

@morganisok
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

Please sign in to comment.