How to add a custom link and icon to the author box

Using filters in Easy Property Listings allows you to add custom user profile icons and a link to that service. Our goal is to add another icon after the email icon using a filter.

Place the following code into a custom settings plugin or your theme functions file.

Add the new custom field to the author profile

// Add custom contact field to user profile
function my_epl_custom_user_contact( $contactmethods ) {
	$contactmethods['custom']	= __( 'Custom', 'easy-property-listings' );

	return $contactmethods;
add_filter ('user_contactmethods','my_epl_custom_user_contact',10,1);

New field displayed on the user profile

Create the HTML output of the custom link and icon

// Create the html output for a custom contact field
function my_epl_get_custom_author_html($html = '') {
	global $epl_author;

	if ( $epl_author->custom != '' ) {
		$html = '
			<a class="epl-author-icon author-icon custom-icon-24" href="' . $epl_author->custom . '"
				title="'.__('Follow', 'easy-property-listings' ).' ' . $epl_author->name . ' '.__('on Custom', 'easy-property-listings' ).'">'.
				 __('C', 'easy-property-listings' ).
	return $html;

Add the icon to the social icon filter

// Add new icon after email icon
function my_epl_custom_social_icons_filter( $html ) {

	// Add the new icon
	$html .= my_epl_get_custom_author_html();

	return $html;
add_filter( 'epl_author_email_html' , 'my_epl_custom_social_icons_filter' );

Add your custom icon and CSS to your theme

/** Add CSS to your theme and icon to your theme images folder **/
.epl-author-icon.custom-icon-24 {
	background: url(images/social-custom-icon.png) 0 0 no-repeat;