Hello friends,
Please provide some help with this issue, I’m totally stuck and don’t know what to do.
Would appreciate your help a lot.
Regards.
Damn, 16 hours of just reading and reading and reading. Is there anyone who knows a solution to this? Please help. I’m sure, the problem is with this code. I’m unable to straighten the query:
<?php
$authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);
if($authors):
foreach($authors as $author):
?>
Would appreciate your help if you can suggest anything. Thanks.
Nobody knows how to set this query straight so that the social networking links can be pulled by the author slug?
Please help as much as you guys can, I’m still counting on you folks 🙂
Thanks guys.
The problem is that you are using a get_results query which returns ALL authors. I can’t test this code, but I think it will work. Save a copy of your author.php template, then try the code below for the socialntwrk div, removing the get_results query and replacing $author->post_author with $curauth->ID:
<div id="socialntwrk">
<?php if(get_the_author_meta('twitter', $curauth->ID) || get_the_author_meta('facebook', $curauth->ID) || get_the_author_meta('linkedin', $curauth->ID) || get_the_author_meta('digg', $curauth->ID) || get_the_author_meta('flickr', $curauth->ID)): ?>
<ul>
<?php if(get_the_author_meta('twitter', $curauth->ID)): ?>
<li><a href='http://twitter.com/<?php the_author_meta('twitter', $curauth->ID); ?>'><img title="Follow me" src="http://sharecommons.com/images/twitter.png" alt="Twitter" /></a></li>
<?php endif; ?>
<?php if(get_the_author_meta('facebook', $curauth->ID)): ?>
<li><a href='http://www.facebook.com/<?php the_author_meta('facebook', $curauth->ID); ?>'><img title="Become a fan" src="http://sharecommons.com/images/facebook.png" alt="Facebook" /></a></li>
<?php endif; ?>
<?php if(get_the_author_meta('linkedin', $curauth->ID)): ?>
<li><a href='http://www.linkedin.com/in/<?php the_author_meta('linkedin', $curauth->ID); ?>'><img title="Connect with me" src="http://sharecommons.com/images/linkedin.png" alt="Linkedin" /></a></li>
<?php endif; ?>
<?php if(get_the_author_meta('digg', $curauth->ID)): ?>
<li><a href='http://digg.com/users/<?php the_author_meta('digg', $curauth->ID); ?>'><img title="Digg me" src="http://sharecommons.com/images/digg.png" alt="Digg" /></a></li>
<?php endif; ?>
<?php if(get_the_author_meta('flickr', $curauth->ID)): ?>
<li><a href='http://www.flickr.com/photos/<?php the_author_meta('flickr', $curauth->ID); ?>/'><img title="My Flickr" src="http://sharecommons.com/images/flickr.png" alt="Flickr" /></a></li>
<?php endif; ?>
</ul>
<?php endif; ?>
<?php endforeach; endif; ?>
</div>
OH MAN! You are my hero! Love you! Thank you so so much!
You’re a life saver, thank you for the help 🙂
You are welcome. Now, please use the dropdown at top right to mark this topic ‘Resolved’.