rAthus icon

[WordPress] ajouter un "nofollow" sur les liens de copyright du footer qui ne sont pas sur la home

rAthus | PRO | 10/19/20 11:01:14 AM UTC (Edited) | 0 ⭐ | 1193 👁️ | Never ⏰ | []
PHP |

630 B

|

None

|

0 👍

/

0 👎

Surcharger dans le child theme le fichier "/wp-content/themes/salient/includes/partials/footer/copyright-bar.php"
 
En tout début de fichier, ajouter ce code juste avant la ligne "if ( 'false' === $disable_footer_copyright ) {" :
 
// Arkanite : on commence à capturer le lien de copyright
ob_start();
 
En toute fin de fichier, juste après le tout dernier "}", ajouter ce code :
 
// Arkanite : si on est pas sur la home page, on rajoute un "nofollow" au lien de copyright
$copyright = ob_get_clean();
if (!is_front_page())
    $copyright = preg_replace('#(href="[^"]*arkanite.com)#','rel="nofollow" $1',$copyright);
echo $copyright;

Comments