|
<?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' ); |