Skip to content

Instantly share code, notes, and snippets.

@ajtroxell
Created June 14, 2013 19:42
Show Gist options
  • Save ajtroxell/5784661 to your computer and use it in GitHub Desktop.
Save ajtroxell/5784661 to your computer and use it in GitHub Desktop.
.author-list ul{
list-style: none;
width: 100%;
margin: 0;
padding: 0;
}
.author-list li {
margin: 0 15px 10px 0;
list-style: none;
height: 90px;
width:300px;
float:left;
padding: 15px 0 15px 0;
border-bottom: 1px solid #ececec;
}
.author-list img.photo {
width: 80px;
height: 80px;
float: left;
margin: 0 15px 0 0;
padding: 3px;
border: 1px solid #ececec;
}
.author-list div .authname {
font-weight:bold;
font-size:13px;
}
.author-list div div.authdet {
font-size:11px;
line-height:18px;
}
.author-list li:nth-child(3n+3) {
margin-right:0px;
}
.clear {clear:both;}
/* Authors List Function */
function contributors() {
global $wpdb;
$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' AND ID <> '57' ORDER BY display_name");
$post_count = get_usernumposts($author->ID);
foreach ($authors as $author )
{
if (get_usernumposts($author->ID) >= 1){
echo "<li>";
echo get_avatar($author->ID);
echo '<div>';
echo "<span class=\"authname\">";
the_author_meta('display_name', $author->ID);
echo "</span>";
echo "<br /><div class=\"authdet\">";
if (get_the_author_meta('user_url', $author->ID) != '' AND get_the_author_meta('twitter', $author->ID) != '' AND get_the_author_meta('facebook', $author->ID) != '')
{
echo "<a href=\"";
the_author_meta('user_url', $author->ID);
echo "\" target=\"new\">Website</a>";
echo " | <a href=\"http://twitter.com/";
the_author_meta('twitter', $author->ID);
echo "\" target=\"new\">Twitter</a>";
echo " | <a href=\"";
the_author_meta('facebook', $author->ID);
echo "\" target=\"new\">Facebook</a><br />";
}
elseif (get_the_author_meta('user_url', $author->ID) != '' && get_the_author_meta('twitter', $author->ID) != '')
{
echo "<a href=\"";
the_author_meta('user_url', $author->ID);
echo "\" target=\"new\">Website</a>";
echo " | <a href=\"http://twitter.com/";
the_author_meta('twitter', $author->ID);
echo "\" target=\"new\">Twitter</a><br />";
}
elseif (get_the_author_meta('user_url', $author->ID) != '' && get_the_author_meta('facebook', $author->ID) != '')
{
echo "<a href=\"";
the_author_meta('user_url', $author->ID);
echo "\" target=\"new\">Website</a>";
echo " | <a href=\"";
the_author_meta('facebook', $author->ID);
echo "\" target=\"new\">Facebook</a><br />";
}
elseif (get_the_author_meta('twitter', $author->ID) != '' && get_the_author_meta('facebook', $author->ID) != '')
{
echo "<a href=\"http://twitter.com/";
the_author_meta('twitter', $author->ID);
echo "\" target=\"new\">Twitter</a>";
echo " | <a href=\"";
the_author_meta('facebook', $author->ID);
echo "\" target=\"new\">Facebook</a><br />";
}
elseif (get_the_author_meta('user_url', $author->ID) != '')
{
echo "<a href=\"";
the_author_meta('user_url', $author->ID);
echo "\" target=\"new\">Website</a><br />";
}
elseif (get_the_author_meta('twitter', $author->ID) != '')
{
echo "<a href=\"http://twitter.com/";
the_author_meta('twitter', $author->ID);
echo "\" target=\"new\">Twitter</a><br />";
}
elseif (get_the_author_meta('facebook', $author->ID) != '')
{
echo "<a href=\"";
the_author_meta('facebook', $author->ID);
echo "\" target=\"new\">Facebook</a><br />";
}
else
{
}
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">";
echo "Biography and Archives";
echo "</a>";
echo "</div></div>";
echo "</li>";
}
}
}
function contributors() {
global $wpdb;
$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' ORDER BY display_name");
foreach ($authors as $author ) {
echo "<li>";
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">";
echo get_avatar($author->ID);
echo "</a>";
echo '<div>';
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">";
the_author_meta('display_name', $author->ID);
echo "</a>";
echo "<br />";
echo "Website: <a href=\"";
the_author_meta('user_url', $author->ID);
echo "/\" target='_blank'>";
the_author_meta('user_url', $author->ID);
echo "</a>";
echo "<br />";
echo "Twitter: <a href=\"http://twitter.com/";
the_author_meta('twitter', $author->ID);
echo "\" target='_blank'>";
the_author_meta('twitter', $author->ID);
echo "</a>";
echo "<br />";
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">Visit&nbsp;";
the_author_meta('display_name', $author->ID);
echo "'s Profile Page";
echo "</a>";
echo "</div>";
echo "</li>";
}
}
// adding custom fields to the user profile
function profile_contact_fields( $contactmethods ) {
// Twitter Field
$contactmethods['twitter'] = 'Twitter ID';
// Facebook Field
$contactmethods['facebook'] = 'Facebook URL';
return $contactmethods;
}
add_filter('user_contactmethods','profile_contact_fields',10,1);
// end of adding custom fields to the user profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment