WordPress Expert and Web Apps Engineer

Hiding Content on WordPress for Patreon Subscribers

Want to make money from random traffic - but spare your subscribers from ads? Use this bit of PHP code to hide ads and other content from Patreon members.
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on reddit
Reddit

DisclosureLinks in this article may be affiliate links to which I earn revenue upon purchase of a product or serviceAll of my reviews are based upon our own unbiased experience with a product or service.

I was very happy recently when Blog Herald ran my article on using Patreon to create members-only content on WordPress. However, there was one interesting topic I didn’t discuss there: hiding content – such as ads – for Patrons.

Monetize Your Free Traffic (But Spare Paying Customers)

In this day and age, no one single revenue stream guarantees financial success. Journalists, creatives, and others whose stock in trade is content need to use multiple strategies to keep their businesses running.

As I discussed on Blog Herald, Patreon is a good way to fund a site if you work in a niche and can build a dedicated following.

But Patreon alone doesn’t have to be your only source of revenue. After all, only a small fraction of your site’s visitors will ever become Patrons. You may want to consider ways you can monetize that casual traffic. Ads are one way (though, admittedly, not my favorite). Another is affiliate banners.

Whatever option you choose, you definitely don’t want your Patrons to see ad content. In fact, just the opposite: you probably want to make turning off ads part of your Patreon sales pitch!

The Code

Fortunately, a recent change to the Patreon Plugin for WordPress makes this very easy. You can use the Patreon Plugin function hide_ad_for_patrons() to determine whether to show an ad to a user. When used properly, it means users who visit your site when logged into their Patreon account and are subscribed at the proper Patreon level will never see ad content.

Below is the code I use to hide certain ads and the Patreon plea itself on my site Unseen Japan. The ad is assigned to a variable, $patreon_show_hide_ad. The hide_ad_for_patrons() function then determines whether the ad should be shown. If it should, it returns the ad code you passed in. If it doesn’t, it returns an empty string.

$patreon_hide_ads_at_and_above = 1;

$patreon_show_hide_ad = <<<EOD

<center>
 <p style="font-style:italic;padding-botton:5px;font-weight:bold;font-size:20px;">Unseen Japan is Reader-Supported. We can't do what we do without your help! If you like what we do, consider a membership through Patreon. Patrons receive early access to essays, exclusive content, thank you gifts and other benefits. All money received through Patreon goes to paying our content creators.</p>

<p><a href="https://www.patreon.com/join/unseenjapan"><img src="https://unseenjapan.com/wp-content/uploads/2020/03/become_a_patron_button.png" alt="Become a Patron!"></a></p>
</center>

EOD;


$patreon_ad_or_not = Patreon_Frontend::hide_ad_for_patrons( $patreon_hide_ads_at_and_above, $patreon_show_hide_ad );


if ( $patreon_ad_or_not != '' ) {
        echo $patreon_ad_or_not;
}
?>

Where Do I Put This Code?

You can add this code directly to your WordPress theme or child theme if you’re comfortable with editing them directly. Just replace your existing ad code with this.

If you haven’t gotten started with ads yet and aren’t comfortable editing your theme, I highly recommend Ad Inserter. Ad Inserter lets you insert ads in positions throughout your site – even in the middle of content – with a simple WordPress plugin UI.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on reddit
Reddit

Contact Me

To get started with a discussion of your needs and a list of prices, please contact me today. I’ll be in touch with you within the next 24 business hours.