Skip to content

Instantly share code, notes, and snippets.

@iamkingsleyf
Forked from neilgee/aauthorbox.php
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamkingsleyf/13009624d7db94ec91e2 to your computer and use it in GitHub Desktop.
Save iamkingsleyf/13009624d7db94ec91e2 to your computer and use it in GitHub Desktop.
<?php
//do not copy the opening php tag above
/**
* Changing the AuthorBox in WordPress
*
* @package Changing the AuthorBox in WordPress
* @author Neil Gee
* @link http://coolestguidesontheplanet.com/author-box-genesis/
* @copyright (c) 2014, Neil Gee
*/
//Change Default Method Contacts in User Profile
function modify_user_contact_methods( $user_contact ){
/* Add user contact methods */
$user_contact['pinterest'] = __( 'Pinterest URL' );
$user_contact['linkedin'] = __( 'LinkedIn URL' );
/* Remove user contact methods */
unset($user_contact['aim']);
unset($user_contact['jabber']);
unset($user_contact['yim']);
return $user_contact;
}
add_filter( 'user_contactmethods', 'modify_user_contact_methods' );
//Load Fontawesome
function themeprefix_fontawesome_styles() {
wp_register_style ( 'fontawesome' , '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css', '' , '4.1.0', 'all' );
wp_enqueue_style( 'fontawesome' );
}
add_action( 'wp_enqueue_scripts', 'themeprefix_fontawesome_styles' );
//Create New Author Box
function themeprefix_alt_author_box() {
if( is_single() ) {
echo "<div class=\"author-box\">" . get_avatar( get_the_author_meta( 'ID' ), '70' ) .
"<div class=\"about-author\"><h4>About " . get_the_author() . "</h4><p>" . get_the_author_meta( 'description' ) .
"</div><ul class=\"social-links\">";
if ( get_the_author_meta( 'linkedin' ) != '' ) {
echo "<li><a href=\"". get_the_author_meta( 'linkedin' ) . "\"><i class=\"fa fa-linkedin\"></i></a></li>";
}
if ( get_the_author_meta( 'facebook' ) != '' ) {
echo "<li><a href=\"". get_the_author_meta( 'facebook' ) . "\"><i class=\"fa fa-facebook\"></i></a></li>";
}
if ( get_the_author_meta( 'twitter' ) != '' ) {
echo "<li><a href=\"https://twitter.com/". get_the_author_meta( 'twitter' ) . "\"><i class=\"fa fa-twitter\"></i></a></li>";
}
if ( get_the_author_meta( 'googleplus' ) != '' ) {
echo "<li><a href=\"". get_the_author_meta( 'googleplus' ) . "\"><i class=\"fa fa-google-plus\"></i></a></li>";
}
if ( get_the_author_meta( 'pinterest' ) != '' ) {
echo "<li><a href=\"". get_the_author_meta( 'pinterest' ) . "\"><i class=\"fa fa-pinterest\"></i></a></li>";
}
if ( get_the_author_meta( 'user_email' ) != '' ) {
echo "<li><a href=\"mailto:". get_the_author_meta( 'user_email' ) . "\"><i class=\"fa fa-envelope-o\"></i></a></li>";
}
if ( get_the_author_meta( 'user_url' ) != '' ) {
echo "<li><a href=\"". get_the_author_meta( 'user_url' ) . "\"><i class=\"fa fa-laptop\"></i> </a></li>";
}
echo "</ul></div>";
}
}
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
add_action( 'genesis_after_entry', 'themeprefix_alt_author_box' );
/* For FontAwesome Icon Stylin */
.social-links {
overflow:auto;
margin-top:10px;
}
.social-links li {
list-style-type: none;
float: left;
}
.social-links a {
border-bottom: none;
}
.social-links i {
background: #205D7A;
color: #fff;
width: 40px;
height: 40px;
border-radius: 20px;
font-size: 25px;
text-align: center;
margin-right: 10px;
padding-top: 15%;
transition-property: opacity;
transition-delay: 0.3s;
transition-duration: .5s;
}
.social-links i:hover {
opacity:.7;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment