• Resolved guy1407

    (@guy1407)


    Hi
    I cannot add rel=publisher to my google plus link.
    Can you fix it please or advise another way to do it ?

    Thanks
    Guy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Guy 😉

    social icons are retrieved by the function “tempera_set_social_icons” (in “theme-functions.php”) via a loop; and for each social link to create, a generic template link is populated by the social link data (target, href, title, etc) set in admin settings, and the only attribute which is hard coded in the template link is the rel attribute:
    <a <?php if ($temperas['tempera_social_target'.$i]) {echo ' target="_blank" ';} ?> rel="nofollow" href="<?php echo $cryout_current_social; ?>"
    so it’s common to all the social links generated.

    luckily, this function is pluggable (it can be overriden by the same function in a child theme), so you can add this in the “functions.php” file of your child theme (in its root folder):

    function tempera_set_social_icons($idd) {
    	$cryout_special_keys = array('Mail', 'Skype');
    	global $temperas;
    	foreach ($temperas as $key => $value) {
    		${"$key"} = $value ;
    	}
    	echo '<div class="socials" id="'.$idd.'">';
    	for ($i=1; $i<=9; $i+=2) {
    		$j=$i+1;
    		if ( ${"tempera_social$j"} ) {
    			if (in_array(${"tempera_social$i"},$cryout_special_keys)) :
    				$cryout_current_social = esc_html( ${"tempera_social$j"} );
    			else :
    				$cryout_current_social = esc_url( ${"tempera_social$j"} );
    			endif;
    
    			if( ${"tempera_social$i"} == GooglePlus ) :
    				$rel = "publisher";
    			else :
    				$rel = "nofollow";
    			endif;
    				?>
    
    			<a <?php if ($temperas['tempera_social_target'.$i]) {echo ' target="_blank" ';} ?> rel="<?php echo $rel; ?>" href="<?php echo $cryout_current_social; ?>"
    			class="socialicons social-<?php echo esc_attr(${"tempera_social$i"}); ?>" title="<?php echo ${"tempera_social_title$i"} !="" ? esc_attr(${"tempera_social_title$i"}) : esc_attr(${"tempera_social$i"}); ?>">
    				<img alt="<?php echo esc_attr(${"tempera_social$i"}); ?>" src="<?php echo get_template_directory_uri().'/images/socials/'.${"tempera_social$i"}.'.png'; ?>" />
    			</a><?php
    		}
    	}
    	echo '</div>';
    } // tempera_set_social_icons()

    where I added a conditionnal definition of a created var “$rel” which is rendered in rel="<?php echo $rel; ?>" in place of rel=”nofollow”

    Thread Starter guy1407

    (@guy1407)

    Thanks again for the great solution my angel 🙂

    Any idea what is it used for ? (rel=publisher)

    Seems to be used to create a bound between your site to your Google+ account…

    You’re welcome! 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘rel=publisher’ is closed to new replies.