Lock "custom" content

Currently I am only able to lock the post contents. However, the wordpress theme I am using has a “custom header”. When I lock a post only the post is locked but not the content in my “custom header”.

I am using this to lock podcast episodes. The actual podcast audio file is locked in a “custom header”. What php do I need to edit to lock additional content that is displayed on the page?

Yes, this is a frequent situation - and there is a solution for it.

By wrapping any part of your theme in the below code, you can lock that part for any $ level you want. Ie, in your case, you would need to wrap whatever outputs your podcast listing inside the code given below:

Awesome! I did not know this existed, thank you!

1 Like

Is there any way for this to work on the per page amount? For example I’m trying to use the VideoPro theme by Cactus themes. In the header of the video post is the embeded video which is not locked via the Patreon plugin even though I have an amount set.

I only want some videos on the site locked.

However, if I put the above code in the header code, won’t it lock all videos under a fixed amount?


Yes the above code would lock all videos. However, you can introduce a post id check to the conditionals to make the code lock only certain posts.

Ie, if the video post’s ids are 356 and 851, check if the current post id is either of them, and if so, allow the lock code.

Could it work on some kind of wildcard? Like if the post title has ‘Early Access’ or ‘Full Length’ in the title for example? Setting individual post id’s is impractical because we are talking hundreds of posts.

Surely, it can work on any conditional you can put into PHP code there.

In this case you can check for post titles, and if titles have certain keywords, you can kick the code in. Or, check the post category, and if it is from a certain category, activate the code etc.

Will this also work with the Patreon Pro plugin? After disabling the normal Patreon plugin, it seemed to break it.

If you disable Patreon WordPress or Patron Button and Widgets, Patron Pro cannot work.

If all 3 are enabled, this code should still work normally as it is.