Home Forums Basel support forum No follow for social media buttons

No follow for social media buttons

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #69268

    gizmoman
    Participant

    Hi Guys, is there any way we can add no follow to social media buttons for SEO purpose?

    Thanks.

    #69302

    Hello,

    You can add no follow to social media buttons using this file inc/shortcodes.php

    Best Regards

    #69414

    gizmoman
    Participant

    not sure what you mean. I am talking about adding the following line rel=”nofollow”

    to the social media icons on the footer.
    Thanks

    #69424

    Hello,

    Using this file inc/shortcodes.php you can insert line rel=”nofollow”

    Best Regards

    #69467

    gizmoman
    Participant

    Sorry, I am not a php expert. So could you please show a sample code of where to add etc. So I can do it for the rest. Also if I do this do I have to keep on updating this file every time the theme is updated?

    #69515

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to do this

    function basel_shortcode_social($atts) {
        extract(shortcode_atts( array(
            'type' => 'share',
            'align' => 'center',
            'tooltip' => 'no',
            'style' => 'default', // circle colored
            'size' => 'default', // circle colored
            'el_class' => '',
        ), $atts ));
    
        $target = "_blank";
    
        $thumb_id = get_post_thumbnail_id();
        $thumb_url = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
    
        $page_link = get_the_permalink();
        if ( basel_woocommerce_installed() && is_shop() ) $page_link = get_permalink( get_option( 'woocommerce_shop_page_id' ) );
        if ( basel_woocommerce_installed() && ( is_product_category() || is_category() ) ) $page_link = get_category_link( get_queried_object()->term_id );
        if ( is_home() && ! is_front_page() ) $page_link = get_permalink( get_option( 'page_for_posts' ) );
    
        ob_start();
        ?>
    
            <ul class="social-icons text-<?php echo esc_attr( $align ); ?> icons-design-<?php echo esc_attr( $style ); ?> icons-size-<?php echo esc_attr( $size ); ?> social-<?php echo esc_attr( $type ); ?> <?php echo esc_attr( $el_class ); ?>">
                <?php if ( ( $type == 'share' && basel_get_opt('share_fb') ) || ( $type == 'follow' && basel_get_opt( 'fb_link' ) != '')): ?>
                    <li class="social-facebook"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'fb_link' ) : 'https://www.facebook.com/sharer/sharer.php?u=' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-facebook"></i><span class="basel-social-icon-name"><?php _e('Facebook', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( ( $type == 'share' && basel_get_opt('share_twitter') ) || ( $type == 'follow' && basel_get_opt( 'twitter_link' ) != '')): ?>
                    <li class="social-twitter"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'twitter_link' ) : 'http://twitter.com/share?url=' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-twitter"></i><span class="basel-social-icon-name"><?php _e('Twitter', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( ( $type == 'share' && basel_get_opt('share_google') ) || ( $type == 'follow' && basel_get_opt( 'google_link' ) != '' ) ): ?>
                    <li class="social-google"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'google_link' ) : 'http://plus.google.com/share?url=' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-google-plus"></i><span class="basel-social-icon-name"><?php _e('Google', 'basel') ?></span></a></li>
                <?php endif ?>
    
                    <?php if ( ( $type == 'share' && basel_get_opt('share_email') ) || ( $type == 'follow' && basel_get_opt( 'social_email' ) ) ): ?>
                    <li class="social-email"><a rel="nofollow" href="mailto:<?php echo '?subject=' . __('Check this ', 'basel') . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-envelope"></i><span class="basel-social-icon-name"><?php _e('Email', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'isntagram_link' ) != ''): ?>
                    <li class="social-instagram"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'isntagram_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-instagram"></i><span class="basel-social-icon-name"><?php _e('Instagram', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'youtube_link' ) != ''): ?>
                    <li class="social-youtube"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'youtube_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-youtube"></i><span class="basel-social-icon-name"><?php _e('YouTube', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( ( $type == 'share' && basel_get_opt('share_pinterest') ) || ( $type == 'follow' && basel_get_opt( 'pinterest_link' ) != '' ) ): ?>
                    <li class="social-pinterest"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'pinterest_link' ) : 'http://pinterest.com/pin/create/button/?url=' . $page_link . '&media=' . $thumb_url[0]; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-pinterest"></i><span class="basel-social-icon-name"><?php _e('Pinterest', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'tumblr_link' ) != ''): ?>
                    <li class="social-tumblr"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'tumblr_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-tumblr"></i><span class="basel-social-icon-name"><?php _e('Tumblr', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'linkedin_link' ) != ''): ?>
                    <li class="social-linkedin"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'linkedin_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-linkedin"></i><span class="basel-social-icon-name"><?php _e('LinkedIn', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'vimeo_link' ) != ''): ?>
                    <li class="social-vimeo"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'vimeo_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-vimeo"></i><span class="basel-social-icon-name"><?php _e('Vimeo', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'flickr_link' ) != ''): ?>
                    <li class="social-flickr"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'flickr_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-flickr"></i><span class="basel-social-icon-name"><?php _e('Flickr', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'github_link' ) != ''): ?>
                    <li class="social-github"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'github_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-github"></i><span class="basel-social-icon-name"><?php _e('GitHub', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'dribbble_link' ) != ''): ?>
                    <li class="social-dribbble"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'dribbble_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-dribbble"></i><span class="basel-social-icon-name"><?php _e('Dribbble', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'behance_link' ) != ''): ?>
                    <li class="social-behance"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'behance_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-behance"></i><span class="basel-social-icon-name"><?php _e('Behance', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'soundcloud_link' ) != ''): ?>
                    <li class="social-soundcloud"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'soundcloud_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-soundcloud"></i><span class="basel-social-icon-name"><?php _e('Soundcloud', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'spotify_link' ) != ''): ?>
                    <li class="social-spotify"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'spotify_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-spotify"></i><span class="basel-social-icon-name"><?php _e('Spotify', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( ( $type == 'share' && basel_get_opt('share_ok') ) || ( $type == 'follow' && basel_get_opt( 'ok_link' ) != '' ) ): ?>
                    <li class="social-ok"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'ok_link' ) : 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=
    ' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-odnoklassniki"></i><span class="basel-social-icon-name"><?php _e('Odnoklassniki', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'share' && basel_get_opt('share_whatsapp') || ( $type == 'follow' && basel_get_opt( 'whatsapp_link' ) != '' ) ): ?>
                    <li class="social-whatsapp"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'whatsapp_link' ) : 'whatsapp://send?text=' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-whatsapp"></i><span class="basel-social-icon-name"><?php _e('WhatsApp', 'basel') ?></span></a></li>
                <?php endif ?>
                
                <?php if ( ( $type == 'share' && basel_get_opt('share_vk') ) || ( $type == 'follow' && basel_get_opt( 'vk_link' ) != '' ) ): ?>
                    <li class="social-vk"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'vk_link' ) : 'https://vk.com/share.php?url=
    ' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-vk"></i><span class="basel-social-icon-name"><?php _e('VKontakte', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'follow' && basel_get_opt( 'snapchat_link' ) != ''): ?>
                    <li class="social-snapchat"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'snapchat_link' ) : '' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-snapchat-ghost"></i><span class="basel-social-icon-name"><?php _e('Snapchat', 'basel') ?></span></a></li>
                <?php endif ?>
    
                <?php if ( $type == 'share' && basel_get_opt('share_tg') || ( $type == 'follow' && basel_get_opt( 'tg_link' ) != '' ) ): ?>
                    <li class="social-tg"><a rel="nofollow" href="<?php echo ($type == 'follow') ? basel_get_opt( 'tg_link' ) : 'https://telegram.me/share/url?url=' . $page_link; ?>" target="<?php echo esc_attr( $target ); ?>" class="<?php if( $tooltip == "yes" ) echo 'basel-tooltip'; ?>"><i class="fa fa-telegram"></i><span class="basel-social-icon-name"><?php _e('Telegram', 'basel') ?></span></a></li>
                <?php endif ?>
    
            </ul>
    
        <?php
        $output = ob_get_contents();
        ob_end_clean();
    
        return $output;
    }
    
    add_shortcode( 'social_buttons', 'basel_shortcode_social' );
    #69649

    gizmoman
    Participant

    Thanks.

    #69701

    You are welcome! If you have any questions please feel free to contact us.

    Best Regards

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘No follow for social media buttons’ is closed to new replies.