Tagged: x
-
AuthorPosts
-
June 22, 2016 at 3:40 pm #1055066
uspatriot55ParticipantIs there a way to change the Share element social media icons? I’d like to use the non-square versions of each.
June 22, 2016 at 9:53 pm #1055633
Rue NelModeratorHello There,
Thanks for writing in! Since what you are trying to accomplish requires a template customization, we would like to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Once you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.
// Custom Social Share // ============================================================================= function x_custom_shortcode_share( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'title' => '', 'share_title' => '', 'facebook' => '', 'twitter' => '', 'google_plus' => '', 'linkedin' => '', 'pinterest' => '', 'reddit' => '', 'email' => '', 'email_subject' => '' ), $atts, 'x_share' ) ); $share_url = urlencode( get_permalink() ); if ( is_singular() ) { $share_url = urlencode( get_permalink() ); } else { global $wp; $share_url = urlencode( home_url( ($wp->request) ? $wp->request : '' ) ); } if ( is_singular() ) { $share_title = ( $share_title != '' ) ? esc_attr( $share_title ) : urlencode( get_the_title() ); } else { $share_title = ( $share_title != '' ) ? esc_attr( $share_title ) : urlencode( apply_filters( 'the_title', get_page( get_option( 'page_for_posts' ) )->post_title) ); } $share_source = urlencode( get_bloginfo( 'name' ) ); $share_image_info = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); $share_image = ( function_exists( 'x_get_featured_image_with_fallback_url' ) ) ? urlencode( x_get_featured_image_with_fallback_url() ) : urlencode( $share_image_info[0] ); if ( $linkedin == 'true' ) { $share_content = urlencode( cs_get_raw_excerpt() ); } $tooltip_attr = cs_generate_data_attributes_extra( 'tooltip', 'hover', 'bottom' ); $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? 'x-entry-share ' . esc_attr( $class ) : 'x-entry-share'; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $title = ( $title != '' ) ? $title : __( 'Share this Post', 'cornerstone' ); $facebook = ( $facebook == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __( 'Share on Facebook', 'cornerstone' ) . "\" onclick=\"window.open('http://www.facebook.com/sharer.php?u={$share_url}&t={$share_title}', 'popupFacebook', 'width=650, height=270, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-facebook\" data-x-icon=\"\"></i></a>" : ''; $twitter = ( $twitter == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __( 'Share on Twitter', 'cornerstone' ) . "\" onclick=\"window.open('https://twitter.com/intent/tweet?text={$share_title}&url={$share_url}', 'popupTwitter', 'width=500, height=370, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-twitter\" data-x-icon=\"\"></i></a>" : ''; $google_plus = ( $google_plus == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __( 'Share on Google+', 'cornerstone' ) . "\" onclick=\"window.open('https://plus.google.com/share?url={$share_url}', 'popupGooglePlus', 'width=650, height=226, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-google-plus\" data-x-icon=\"\"></i></a>" : ''; $linkedin = ( $linkedin == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __( 'Share on LinkedIn', 'cornerstone' ) . "\" onclick=\"window.open('http://www.linkedin.com/shareArticle?mini=true&url={$share_url}&title={$share_title}&summary={$share_content}&source={$share_source}', 'popupLinkedIn', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-linkedin\" data-x-icon=\"\"></i></a>" : ''; $pinterest = ( $pinterest == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __( 'Share on Pinterest', 'cornerstone' ) . "\" onclick=\"window.open('http://pinterest.com/pin/create/button/?url={$share_url}&media={$share_image}&description={$share_title}', 'popupPinterest', 'width=750, height=265, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-pinterest\" data-x-icon=\"\"></i></a>" : ''; $reddit = ( $reddit == 'true' ) ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __( 'Share on Reddit', 'cornerstone' ) . "\" onclick=\"window.open('http://www.reddit.com/submit?url={$share_url}', 'popupReddit', 'width=875, height=450, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-reddit\" data-x-icon=\"\"></i></a>" : ''; $email_subject = ( $email_subject != '' ) ? esc_attr( $email_subject ) : __( 'Hey, thought you might enjoy this! Check it out when you have a chance:', 'cornerstone' ); $mail_to = esc_url( "mailto:?subject=" . get_the_title() . "&body=" . $email_subject . " " . get_permalink() . "" ); $email = ( $email == 'true' ) ? "<a href=\"{$mail_to}\" {$tooltip_attr} class=\"x-share email\" title=\"" . __( 'Share via Email', 'cornerstone' ) . "\"><span><i class=\"x-icon-envelope\" data-x-icon=\"\"></i></span></a>" : ''; $output = "<div {$id} class=\"{$class}\" {$style}>" . '<p>' . $title . '</p>' . '<div class="x-share-options">' . $facebook . $twitter . $google_plus . $linkedin . $pinterest . $reddit . $email . '</div>' . '</div>'; return $output; } function update_x_share_shortcode() { remove_shortcode( 'x_share' ); add_shortcode( 'x_share', 'x_custom_shortcode_share' ); } add_action('wp_head', 'update_x_share_shortcode'); // =============================================================================Please copy the raw code from here (http://pastebin.com/AeE1PqrM) to preserve the unicode html entities or data-x-icon value.
Please let us know if this works out for you.
October 18, 2016 at 7:13 am #1220712
uspatriot55ParticipantNever mind.
October 18, 2016 at 7:47 am #1220749
JoaoModeratorLet us know if you need further help,
Joao
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1055066 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
