III. Using Genesis Simple Hooks
If you are on the Genesis Framework, and are utilizing the Genesis Simple Hooks to place coding in places such as before the content or before the header, you will be changing this code up a bit.
This is what this is what it would look like inside your Genesis Simple Hook:
Using the category or tag ID number from before, and choosing the correct Genesis Simple Hook, you’re going to put in a slightly different PHP code.
Let’s say that you want to HIDE a leaderboard ad from showing up when you have a sponsored post in the genesis_before_header hook. You would use this template:
Make sure you check off “Execute PHP on this hook” so that the code works.
This ends our tutorial today. Let me know if you have any questions in the comments section!
Christy @ Our Southern Home says
Thanks so much, Lisette!! These directions are so clear! I just started with BlogHer and was successful in implementing the code to not show ads on sponsored posts. Pinning and sharing!! ~Christy
jackie says
ahhh yay thanks so much for this! made so much more sense than when i tried to follow the directions from blogher!
estherjulee says
thank you for sharing this.. it was really helpful. Could you explain more on how to use it with tags. It wasn’t working when I used the in_category(‘#’) <- using the tag number. I also tried in_tag('#') but i'm sure that wasn't the proper code.
Lisette says
It should work if you swap out is_category() with is_tag(). Just make sure you’re entering is_tag instead of in_tag.
Morgan says
This was so helpful! Thanks for the screenshots and step-by-step :-).
Katie | Healthy Seasonal Recipes says
Thank you so much! This worked perfectly. Glad to know that the Jet Pack option would bog down the site. The other method was not hard and I am terrible at tech stuff.
L.M says
Hi! Thanks so much for this post! Quick question: what if you have two different categories? Like for review and for sponsored?
Stephanie Powers says
Thank you for this awesome explanation!! I’m up late writing my first sponsored post and couldn’t get my BlogHer ads to stop showing up with the code I was trying to use. You’re a life saver!
Lisette says
You’re very welcome! Glad to help :)
royalediting.com says
I also would like to thank you for the greatest well-grounded explanation! It was a real pleasure for me to read the entire post!