Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created June 4, 2012 02:22
Show Gist options
  • Save billerickson/2865940 to your computer and use it in GitHub Desktop.
Save billerickson/2865940 to your computer and use it in GitHub Desktop.
<?php
/**
* Template Name: Authors
*
* @package BE_Genesis_Child
* @since 1.0.0
* @link https://github.com/billerickson/BE-Genesis-Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
// Full Width Layout
add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
/**
* Author Loop
*
*/
function be_author_loop() {
$users = get_users();
foreach( $users as $user ) {
$output = '';
$output .= '<div class="author-box">';
$output .= '<div class="left">';
$output .= get_avatar( get_the_author_meta( 'email', $user->ID ), 200 );
$output .= '</div><!-- .left -->';
$output .= '<div class="right">';
$name = $user->display_name;
$title = get_the_author_meta( 'title', $user->ID );
if( !empty( $title ) )
$name .= ', ' . $title;
$output .= '<h4 class="title"><a href="' . get_author_posts_url( $user->ID ) . '">' . $name . '</a>';
$output .= '<span class="social">';
if( get_the_author_meta( 'twitter', $user->ID ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'twitter', $user->ID ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-twitter-author.png" /></a> ';
if( get_the_author_meta( 'gplus', $user->ID ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'gplus', $user->ID ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-gplus-author.png" /></a> ';
if( get_the_author_meta( 'linkedin', $user->ID ) )
$output .= '<a href="' . esc_url( get_the_author_meta( 'linkedin', $user->ID ) ) . '"><img src="' . get_stylesheet_directory_uri() . '/images/icon-linkedin-author.png" /></a> ';
$output .= '<a href="' . trailingslashit( get_author_posts_url( $user->ID ) ) . 'feed"><img src="' . get_stylesheet_directory_uri() . '/images/icon-feed-author.png" /></a>';
$output .= '</span>';
$output .= '<a class="email" href="mailto:' . get_the_author_meta( 'email', $user->ID ) . '">Email ' . get_the_author_meta( 'email', $user->ID ) . '</a>';
$output .= '</h4>';
$output .= '<p class="desc">' . get_the_author_meta( 'description', $user->ID ) . '</p>';
$output .= '</div><!-- .right -->';
$output .= '</div><!-- .author-box -->';
echo $output;
}
}
add_action( 'genesis_loop', 'be_author_loop' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment