Tagged: x
-
AuthorPosts
-
June 23, 2016 at 12:49 am #1055820
knamakyParticipantgurulocity.com
I am attempting to add LinkedIn to the Author Bio and am using the following code in the functions.php in the child theme. In WordPress it adds a line to place the LinkedIn page link, however the LinkedIn icon is still not showing in the bio. Code is as follows:
function modify_contact_methods($profile_fields) {
$profile_fields[‘linkedIn’] = ‘LinkedIn’;
return $profile_fields;
}
add_filter(‘user_contactmethods’, ‘modify_contact_methods’);function custom_x_shortcode_post_author( $atts ) {
extract( shortcode_atts( array(
‘id’ => ”,
‘class’ => ”,
‘style’ => ”,
‘title’ => ”,
‘author_id’ => ”
), $atts, ‘x_author’ ) );$id = ( $id != ” ) ? ‘id=”‘ . esc_attr( $id ) . ‘”‘ : ”;
$class = ( $class != ” ) ? ‘x-author-box cf ‘ . esc_attr( $class ) : ‘x-author-box cf’;
$style = ( $style != ” ) ? ‘style=”‘ . $style . ‘”‘ : ”;
$title = ( $title != ” ) ? $title : __( ‘About the Author’, csl18n() );
$author_id = ( $author_id != ” ) ? $author_id : get_the_author_meta( ‘ID’ );$description = get_the_author_meta( ‘description’, $author_id );
$display_name = get_the_author_meta( ‘display_name’, $author_id );
$facebook = get_the_author_meta( ‘facebook’, $author_id );
$twitter = get_the_author_meta( ‘twitter’, $author_id );
$googleplus = get_the_author_meta( ‘googleplus’, $author_id );
$linkedIn = get_the_author_meta( ‘linkedIn’, $author_id );$facebook_output = ( $facebook ) ? “<i class=\”x-icon-facebook-square\” data-x-icon=\”\”></i> Facebook” : ”;
$twitter_output = ( $twitter ) ? “<i class=\”x-icon-twitter-square\” data-x-icon=\”\”></i> Twitter” : ”;
$googleplus_output = ( $googleplus ) ? “<i class=\”x-icon-google-plus-square\” data-x-icon=\”\”></i> Google+” : ”;
$linkedIn_output = ( $linkedIn ) ? “<i class=\”x-icon-linkedin-square\” data-x-icon=\”\”></i> Google+” : ”;$output = “<div {$id} class=\”{$class}\” {$style}>”
. “<h6 class=\”h-about-the-author\”>{$title}</h6>”
. get_avatar( $author_id, 180 )
. ‘<div class=”x-author-info”>’
. “<h4 class=\”h-author mtn\”>{$display_name}</h4>”
. $facebook_output
. $twitter_output
. $googleplus_output
. $linkedIn_output
. “<p class=\”p-author mbn\”>{$description}</p>”
. ‘</div>’
. ‘</div>’;return $output;
}function add_custom_author_shortcode(){
remove_shortcode( ‘x_author’ );
add_shortcode( ‘x_author’, ‘custom_x_shortcode_post_author’ );
}
add_action( ‘init’, ‘add_custom_author_shortcode’);June 23, 2016 at 3:30 am #1055948
ChristianModeratorHey there,
Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You might want to contact our trusted partners who caters X setup and customization needs. Please see https://community.theme.co/custom-development/. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding. Take care!
September 26, 2016 at 4:44 pm #1191446
fmawebParticipantIf you are still at a stuck I just had to do something similiar to pull in the website field as well as allow the company name to be pulled in via the shortcode. I chose to allow the company to be pulled in via the shortcode rather than modify the default fields in wordpress that grab author meta.
The shortcode I use now is [x_author title=”About the Author” company=”Add Company Here if needed”]
/* Change Shortcode Author Meta */ function x_shortcode_author_v2( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'title' => '', 'company' => '', 'author_id' => '' ), $atts, 'x_author' ) ); $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? 'x-author-box cf ' . esc_attr( $class ) : 'x-author-box cf'; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $title = ( $title != '' ) ? $title : __( 'About the Author New', csl18n() ); $company = ($company != '' ) ? $company : __( '', csl18n() ); $author_id = ( $author_id != '' ) ? $author_id : get_the_author_meta( 'ID' ); $description = get_the_author_meta( 'description', $author_id ); $display_name = get_the_author_meta( 'display_name', $author_id ); $url = get_the_author_meta( 'url', $author_id ); $facebook = get_the_author_meta( 'facebook', $author_id ); $twitter = get_the_author_meta( 'twitter', $author_id ); $googleplus = get_the_author_meta( 'googleplus', $author_id ); $url_output = ( $url ) ? "<a href=\"{$url}\" class=\"x-author-social\" title=\"Visit the Website for {$display_name}\" target=\"_blank\"><i class=\"x-icon-external-link-square\" data-x-icon=\"\"></i> Website</a>" : ''; $facebook_output = ( $facebook ) ? "<a href=\"{$facebook}\" class=\"x-author-social\" title=\"Visit the Facebook Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-facebook-square\" data-x-icon=\"\"></i> Facebook</a>" : ''; $twitter_output = ( $twitter ) ? "<a href=\"{$twitter}\" class=\"x-author-social\" title=\"Visit the Twitter Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-twitter-square\" data-x-icon=\"\"></i> Twitter</a>" : ''; $googleplus_output = ( $googleplus ) ? "<a href=\"{$googleplus}\" class=\"x-author-social\" title=\"Visit the Google+ Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-google-plus-square\" data-x-icon=\"\"></i> Google+</a>" : ''; $output = "<div {$id} class=\"{$class}\" {$style}>" . "<h6 class=\"h-about-the-author\">{$title}</h6>" . get_avatar( $author_id, 180 ) . '<div class="x-author-info">' . "<h4 class=\"h-author mtn\">{$display_name}</h4>" . "<p class=\"h-author mtn\"> {$company} </p>" . $url_output . $facebook_output . $twitter_output . $googleplus_output . "<p class=\"p-author mbn\">{$description}</p>" . '</div>' . '</div>'; return $output; } add_filter('init', 'update_x_shortcode_author'); function update_x_shortcode_author() { remove_shortcode( 'x_author' ); add_shortcode( 'x_author', 'x_shortcode_author_v2' ); }September 26, 2016 at 6:03 pm #1191509 -
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1055820 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
