Last active
October 9, 2020 11:06
-
-
Save thecodepoetry/d67c058ebf899a7e6afd12d925f01740 to your computer and use it in GitHub Desktop.
Share buttons shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function share_func( $atts ){ | |
$share_buttons = the7_get_share_buttons_list( 'post'); | |
if ( apply_filters( 'presscore_hide_share_buttons', empty( $share_buttons ) ) ) { | |
return; | |
} | |
if ( 'on_hover' === of_get_option( 'social_buttons-visibility' ) ) { | |
$wrap_class .= ' show-on-hover'; | |
} | |
$share_buttons_header = the7_get_share_buttons_header( 'post' ); | |
$share =''; | |
$share .= '<div class="single-share-box '.esc_attr( $wrap_class ).'">'; | |
$share .= '<div class="share-link-description">'.esc_html( $share_buttons_header ).'</div>'; | |
$share .= '<div class="share-buttons">'; | |
foreach ( $share_buttons as $share_button ) { | |
$share .= '<a class="'.esc_attr( $share_button["icon_class"] ).'" href="'.esc_url( $share_button["url"] ).'" title="'.esc_attr( $share_button["name"] ).'" target="_blank" '.$share_button["custom_atts"].'><span class="soc-font-icon"></span><span class="social-text">'.esc_html( $share_button["alt_title"] ).'</span><span class="screen-reader-text">'.esc_html( $share_button["title"] ).'</span></a>'; | |
} | |
$share .= '</div></div>'; | |
return $share; | |
} | |
add_shortcode( 'sharebuttons', 'share_func' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please try this code in your child theme fucntions.php
Then add [sharebuttons] shortcode to the editor
Also add below custom CSS to to Theme options > Advacned > Custom CSS section