Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpc_extra_post_share_links( $echo = true ) {
- $output = '';
- $networks = array();
- // this is backwards due to how epanel saves checkboxes values
- $excluded_networks = et_get_option( "extra_post_share_icons", array() );
- foreach ( ET_Social_Share::get_networks() as $network ) {
- if ( !in_array( $network->slug, $excluded_networks ) ) {
- $networks[$network->slug] = $network;
- }
- }
- $permalink = get_the_permalink();
- $title = get_the_title();
- foreach ( $networks as $network ) {
- $share_url = $network->create_share_url( $permalink, $title );
- $share_title = sprintf( __( 'Share "%s" via %s', 'extra' ), $title, $network->name );
- if ($network->slug === 'basic_email') {
- $output .= sprintf(
- '<a href="%1$s" class="social-share-link wpc-email-link" title="%2$s" data-network-name="%3$s" data-share-title="%4$s" data-share-url="%5$s" onclick="javascript: return true;">
- <span class="et-extra-icon et-extra-icon-%3$s et-extra-icon-background-hover" ></span>
- </a>',
- 'mailto:'.get_option('admin_email'),
- esc_attr( $share_title ),
- esc_attr( $network->slug ),
- esc_attr( $title ),
- esc_attr( $permalink )
- );
- } else {
- $output .= sprintf(
- '<a href="%1$s" class="social-share-link" title="%2$s" data-network-name="%3$s" data-share-title="%4$s" data-share-url="%5$s">
- <span class="et-extra-icon et-extra-icon-%3$s et-extra-icon-background-hover" ></span>
- </a>',
- $share_url,
- esc_attr( $share_title ),
- esc_attr( $network->slug ),
- esc_attr( $title ),
- esc_attr( $permalink )
- );
- }
- ?>
- <?php
- }
- if ( $echo ) {
- echo $output;
- } else {
- return $output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment