Insert nofollow in a “Powered By” link, except in the homepage [closed]
I don’t know if it’s any more elegant, but if you don’t like duplicating the HTML code, you could do this: function prefix_poweredby() { $html=”<a href=”https://example.com””; if ( ! is_front_page() ) { $html .= ‘ rel=”nofollow”‘; } $html .= ‘ target=”_blank”>link</a>’; echo $html; } add_action(‘wp_footer’, ‘prefix_poweredby’);