Need to turn VigLink off for a specific post on a site running a StudioPress theme from the Genesis Framework?
What a mouthful… It’s easy with the right code.  (Jump below to skip the backstory)
Well I did too.  I was working on a client site Viv, a women’s fashion magazine.
We were running Viglink across the site.  The monetization of the site through Viglink was not something to write home about, however the stats that come with Viglink were very insightful.
We published an article and for a variety of reasons, we needed to insure that the viglink script did not load on this one particular page.  It was creating a couple different types of conflicts unrelated to Viglink itself.
UPDATE 2016 – In addition to the PHP coding method, I illustrated originally. VigLink has added an additional method that allows us to turn off links at a category level after choosing the content management system we are using, in my case WordPress.
See their article from last fall

How do I configure and customize VigLink Insert?

How to turn off Viglink in a Genesis powered theme

So here’s how it works.  You simply need to add a bit of code to your functions.php file.  (I could not find a plugin to do the same thing, but one shouldn’t be too hard to create if you know your way around plugins.
Warning! Don’t go messing with your functions.php file unless you take the proper precautions, backing up your site, database and keeping your working files straight.  In this case Vivmag is hosted on WPEngine and 90% of that is taken care of there as part of the plan.

The Code for custom body classes on a Post

[php highlight=”4,5″]/** Add custom class to posts specified by slug to remove viglink */
add_filter( ‘body_class’, ‘sp_body_class’ );
function sp_body_class( $classes ) {
if ( is_single( ‘your-blog-post-slug-here’ ))
$classes[] = ‘nolinks’;
return $classes;
StudioPress does offer up how to do this (partly) with pages, but they don’t explicitly state it with individual blog posts. The WordPress Codex makes it easy enough to fill in that gap.

How to Add Custom Body Class

Child themes and a framework are the only way you should build your WordPress site and Genesis has great support for child themes and other WordPress functionality. Knowing my blog is well optimized, secure and easy to update lets me get on with developing content, community and building a business from my blogging. AgentPress is a clean and elegant design, perfect for real estate professionals. Via

VigLink itself wasn’t too helpful.  They actually had two different support pages on the topic that provided two different types of code.  One of them was apparently out of date and doesn’t work.  This is the one that DOES work.  🙂

VigLink Developer Guide

If you’re a developer looking for the ideal way to integrate VigLink into your service, you’ve come to the right place. VigLink has built a variety of integration methods that can work across websites (including blogs, forums, web apps), mobile apps, and even desktop apps. In this guide, we document the various ways we make VigLink services available and the controls we provide to developers. Via

Pin It on Pinterest

Share This