WordPress.org

Ready to get started?Download WordPress

Forums

Simple Links
[resolved] Set nofollow by location? (3 posts)

  1. redactuk
    Member
    Posted 5 months ago #

    While having a nofollow option per link is fine, what I would really like is that option available on the widget settings.

    On my site I have several widgets to display some links in various places and then a links page to show them all. Currently I have no way to have links as nofollow in some places but not the other.

    Anyway, while I appreciate this is maybe a wishlist item, if anyone knows a temporary way to achieve this I would be grateful.

    Thanks

    https://wordpress.org/plugins/simple-links/

  2. Mat Lipe
    Member
    Plugin Author

    Posted 5 months ago #

    Hi redactuk,

    You are correct in thinking this plugin does not support this feature. Because it is not an often used feature it will probably not be added in the future.

    It could be accomplished by creating an add-on. Otherwise you could use the following code in your theme to accomplish this.

    Add this to your theme's functions.php file

    function simple_links_remove_no_follow( $meta ){
    	$meta['link_target_nofollow'][0] = 0;
    	return $meta;
    }
    function simple_links_set_no_follow( $meta ){
    	$meta['link_target_nofollow'][0] = 1;
    	return $meta;
    }

    Above any section you want the no follow to be on for all links add

    add_filter( 'simple_links_meta', 'simple_links_set_no_follow');

    After the section add

    remove_filter( 'simple_links_meta', 'simple_links_set_no_follow');

    Above any section you want to remove the no follow add
    add_filter( 'simple_links_meta', 'simple_links_remove_no_follow');
    After the section add
    remove_filter( 'simple_links_meta', 'simple_links_remove_no_follow');

    Hope this helps

  3. redactuk
    Member
    Posted 5 months ago #

    Hi Mat, thank you very much for you helpful response, appreciated.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.