How to add no follow tag to Fancy Images shortcode

resolved (10 posts) (3 voices)

  1. Tim_A
    Member

    I have images that are linked to external affiliate sites and it is important to add the rel="nofollow" tag to these links. I am using the Fancy Images shortcode to display these images. Here is the original link code:

    [fancy_images width="195" height="102"]
    [image title="Title" alt="Alt" link_to="http://www.link.com"]Click here[/image]
    [/fancy_images]

    I tried to add the no follow tag to the shortcode like this but it did not work correctly:
    [fancy_images width="195" height="102"]
    [image title="Title" alt="Alt" rel="nofollow" link_to="http://www.link.com"]Click here[/image]
    [/fancy_images]

    Do you know of a way I can successfully add the no follow tag to external links using this shortcode?

    Thanks!

    Posted 2 years ago #
  2. Elliott
    Support

    Hello Tim_A,

    I think the line your looking for is 267 in /wp-content/themes/[your_theme]/lib/functions/image.php. The problem here though is that it's going to change it for all images used.

    I think it would be better if you used the image_frame shortcode instead and surrounded it with a link like so,

    <a href = "#">
    [image_frame link_to = "false" prettyphoto = "false"]link to your image[/image_frame]
    </a>
    Posted 2 years ago #
  3. Tim_A
    Member

    Hi Elliot,

    That worked great! Thanks.

    One more questions... I would also like to add the no follow tag to buttons. So I tried to accomplish this similarly to the way you demonstrated above but it does not work. The link seems to just link back to the page it is posted on regardless of what URL you point it towards.

    Here is my sample code...

    [button size="large" variation="orange" textColor="#FFFFFF" align="center"]Text Here[/button]

    Tim

    Posted 2 years ago #
  4. Tim_A
    Member

    Sorry, looks like my sample code didn't work above. Can't seem to figure out how to make code show properly in this forum either Lol. for working for me.

    Anyway, the buttons on this page are the ones I would like to add the rel="no follow" tag to -
    http://affiliateboy.net/link-emperor-review/

    Thanks!

    Posted 2 years ago #
  5. Tim_A
    Member

    Let me be more clear. The orange button at the bottom of the page.

    Posted 2 years ago #
  6. Elliott
    Support

    Hello Tim_A,

    That looks like a plugin, you'll need to contact the plugin authors for instructions. We could give you some javascript to change it but I don't think that's going to work with robots/spiders/crawlers.

    Posted 2 years ago #
  7. Tim_A
    Member

    Hi Elliot,

    Not the plugin. I was talking about the Fancy button generated with the InFocus shortcode. I need to add no follow tags to that.

    Thanks,

    Tim

    Posted 2 years ago #
  8. Hi Tim!

    So, you can edit the lib/shortcodes/02-buttons.php file and by line 122 where you have this:
    $out = '<a href="' . esc_url( $link ) . '" class="button_link hover_fade' . $size . $target . $align . $variation . '"' . $style . '><span>' . mysite_remove_wpautop( $content ) . '</span></a>';

    You'll use this instead:
    $out = '<a rel="nofollow" href="' . esc_url( $link ) . '" class="button_link hover_fade' . $size . $target . $align . $variation . '"' . $style . '><span>' . mysite_remove_wpautop( $content ) . '</span></a>';

    Let us know how this works!
    []'s

    Posted 2 years ago #
  9. Tim_A
    Member

    Boom. Perfect Rochester. Thanks for you help!

    May I make a suggestion? All shortcodes with the ability to link out to external sites should also have the option to add the rel="nofollow" tag on a per case basis. Not having a nofollow tag in any advertising or affiliate link is a no-no in the eyes of Google.

    Posted 2 years ago #
  10. Hey Tim,

    I'll certainly let our dev team know about your suggestion. Thanks a lot!

    Oh, and I'm glad it's working, just let us know if you need more help!
    []'s

    Posted 2 years ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme