Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted fixes for #1117, where post_author twitter account is used instead of coauthor #1118

Merged
merged 3 commits into from
Feb 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions inc/post-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ function largo_post_social_links( $echo = true ) {

$output = '<div class="largo-follow post-social clearfix">';

$values = get_post_custom( $post->ID );

if ( $utilities['facebook'] === '1' ) {
$fb_share = '<span class="facebook"><a target="_blank" href="http://www.facebook.com/sharer/sharer.php?u=%1$s"><i class="icon-facebook"></i><span class="hidden-phone">%2$s</span></a></span>';
$output .= sprintf(
Expand All @@ -211,7 +213,6 @@ function largo_post_social_links( $echo = true ) {

// If there are coauthors, use a coauthor twitter handle, otherwise use the normal author twitter handle
// If there is a custom byline, don't try to use the author byline.
$values = get_post_custom( $post->ID );
if ( function_exists( 'coauthors_posts_links' ) && !isset( $values['largo_byline_text'] ) ) {
$coauthors = get_coauthors( $post->ID );
$author_twitters = array();
Expand All @@ -225,7 +226,7 @@ function largo_post_social_links( $echo = true ) {
}
// in the event that there are more than one author twitter accounts, we fall back to the org account
// @link https://github.com/INN/Largo/issues/1088
} else if ( !isset( $values['largo_byline_text'] ) ) {
} else if ( empty($via) && !isset( $values['largo_byline_text'] ) ) {
$user = get_the_author_meta( 'twitter' );
if ( !empty( $user ) ) {
$via = '&via=' . esc_attr( largo_twitter_url_to_username( $user ) );
Expand Down Expand Up @@ -290,10 +291,14 @@ function largo_post_social_links( $echo = true ) {
}

// Try to get the author's Twitter link
$twitter_username = get_user_meta( $post->post_author, 'twitter', true );
if ( ! empty( $twitter_username ) ) {
$twitter_link = 'https://twitter.com/' . $twitter_username;
$more_social_links[] = '<li><a href="' . $twitter_link . '"><i class="icon-twitter"></i> <span>Follow this author</span></a></li>';
// Commented out until we get a better grasp of coauthors
// Don't do this if we have a custom byline text
if ( ! function_exists('get_coauthors') && !isset( $values['largo_byline_text'] ) ) {
$twitter_username = get_user_meta( $post->post_author, 'twitter', true );
if ( ! empty( $twitter_username ) ) {
$twitter_link = 'https://twitter.com/' . $twitter_username;
$more_social_links[] = '<li><a href="' . $twitter_link . '"><i class="icon-twitter"></i> <span>Follow this author</span></a></li>';
}
}

if ( count( $more_social_links ) ) {
Expand Down