Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi there,
    open part-social-sharing.php and replace all with

    <?php if( in_the_loop() ): ?>
    	<ul class="socials">
    		<?php
    			$thumb_id = get_post_thumbnail_id();
    
    			$target = '';
    			if ( get_theme_mod( 'social_target', 1 ) == 1 ) {
    				$target = 'target="_blank"';
    			}
    
    			$facebook = add_query_arg( array(
    				'u' => get_permalink(),
    			), 'https://www.facebook.com/sharer.php' );
    
    			$twitter = add_query_arg( array(
    				'url' => get_permalink(),
    			), 'https://twitter.com/share' );
    
    			$pinterest = add_query_arg( array(
    				'url'         => get_permalink(),
    				'description' => get_the_title(),
    				'media'       => olsen_get_image_src( get_post_thumbnail_id(), 'large' ),
    			), 'https://pinterest.com/pin/create/bookmarklet/' );
    		?>
    		<li><a rel="nofollow" href="<?php echo esc_url( $facebook ); ?>" <?php echo $target; ?> class="social-icon"><i class="fa fa-facebook"></i></a></li>
    		<li><a rel="nofollow" href="<?php echo esc_url( $twitter ); ?>" <?php echo $target; ?> class="social-icon"><i class="fa fa-twitter"></i></a></li>
    		<?php if ( ! empty( $thumb_id ) ): ?>
    			<li rel="nofollow"><a href="<?php echo esc_url( $pinterest ); ?>" <?php echo $target; ?> class="social-icon"><i class="fa fa-pinterest"></i></a></li>
    		<?php endif; ?>
    
    	</ul>
    <?php endif; ?>
    
    		

    Pinterest will only appear if you have a featured image https://www.wpbeginner.com/glossary/featured-image/.
    If you decide to proceed with this modification I would suggest you create a child theme, copy over the files you are editing and make the modifications there. This will allow your changes to survive future theme updates. If you directly edit the theme’s files, all changes will be lost once you update.

    Have a look at this guide to learn more about child themes and how to create one https://www.cssigniter.com/ignite/beginners-guide-child-themes/

    Let me know if you need additional help with this.

    Thread Starter registriran

    (@registriran)

    Hi, that code kind of broke my website.

    Pinterest is not of top importance, I’d be happy to only leave Facebook and Twitter and make them “nofollow”

    Thanks!

    Thread Starter registriran

    (@registriran)

    Hi, again, I fixed it by editing the old code.

    I just removed the lines concerning G+, and added the “nofollow” tags to the other two (facebook and twitter).

    IN case this is of importance: I haven’t updated the theme in 2 years which may account for the new code broking it.

    Thanks again

    • This reply was modified 4 years, 7 months ago by registriran.

    Glad to hear that!
    Please update the theme, it has a lot of new features, and we removed the G+ in the new versions of the theme.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Setting a “nofollow” tag to social icons’ is closed to new replies.