David Artiss

How to suppress Skimlinks for some content in WordPress


Due to updates, over time, that have been made to the site and the age of this article, this post may not display correctly. In particular images may be missing or product reviews display incorrectly.

If this is the case and you'd particularly like me to fix it, then please reach out to me on Twitter.

Skimlinks is a great way to moneterise a blog. Once signed up and approved you simple need to add a line of JavaScript to your site and it will add moneterised links to your output. However, you may be adding sponsored posts or your own links and may not want Skimlinks to modify the entire, or portion of, the post. Simply open up your theme’s functions.php file and add the following lines…

Now simply use the new shortcode of noskim to suppress any post or page content.

For example…

[noskim]This is a line about an iPhone at Dixons. I don’t want any of the text to be linked to by Skimlinks[/noskim]

Skimlinks provide a WordPress plugin that adds the appropriate code to your site. However, you can do this yourself, and improve upon it, by a few further lines added to your functions.php file…

This will add the Skimlinks script to your site’s footer – simply replace xxxx with your Skimlinks number. Additionally, this script is designed to only allow Skimlinks to be placed on single posts and pages – you can update this depending on your site’s requirements.

Lastly, you probably don’t want Skimlinks to appear on site parts of your site – e.g. the header, footer and sidebar. To suppress this you’ll need to have a bit more coding knowledge – identify the appropriate DIV that covers each area and add a class of “noskim” to it.

For example, say you have <div class="footer"> that covers the footer area of your site. If you change this to <div class="footer noskim"> then this will prevent any Skimlinks from appearing in the footer.


Sony PlayStation Vita » « Star Wars Episode I: The Phantom Menace 3D

1 Comment

  1. Thanks for this post – very helpful.

    Just as an FYI, when you copy and paste the code above, it automatically adds your byline “Read more: Development, WordPress : How to suppress Skimlinks for some content in WordPress – Artiss.co.uk” – so when I cut and pasted this into my functions.php file and quickly saved without checking it first, it broke my site! I had to go into my file manager and delete this line before my site would work again.

    Thanks, Victoria

Talk to me!

Copyright © 2017 David Artiss

Theme by Anders NorenUp ↑

Scroll Up
%d bloggers like this: