I’ve been using Genesis for quite a while and till just a few hours ago, I didn’t know I could actually do away with the “Post Layout” plugin I’ve been using to add Google ads and other codes to properly format my post pages. Over the last few weeks, I’ve been trying to reduce my number of installed plugins in order to decrease page load time and also CPU usage. From disabling StatPress, Auto Excerpt Everywhere, down to Social Author bio and loads of other plugins, I thought it would be a good idea to use Genesis Hooks and some conditional statements to display ads and other codes instead of relying a third-party plugin I didn’t really need.
Finally, I was able to display the ads and other stuffs just the way I wanted it and right now, I’m using Genesis hooks to display everything you see above and below posts. As a matter of fact, it rather fun digging into the code side of things… got to learn more WordPress conditional statements (I never really did care because I didn’t know how useful they were).
We’re adding these adsense codes or custom PHP / HTML in five positions in this tutorial, it’s up to you to choose where you want your stuffs to appear:
1. The sidebar
2. Below the header
3. Below post title
4. After post content
5. Above posts in archive pages
1. Adding ad codes to the sidebar
Well, I’m not sure I need to explain this but for beginners, you only need to go to Appearance > Widgets. Drag the text widget to your desired location and paste the ad code or custom HTML. That’s it.
2. Adding Google Adsense below the header
I already explained this in a previous post but this is going to be a bit advanced. For someone like me who has a skycrapper on the sidebar and two ad units on post pages, I would like hide that leaderboard below the menu on post pages. This is where conditional statements come in; you only need to add a snippet of code to tell the advert not to appear on single posts and pages.
- Download and install Simple Genesis Hooks
- Go to Genesis > Simple Hooks
- Scroll down till you get to the content section
- In the box labelled genesis_before_content_sidebar_wrap Hook, paste this code:
<div align="center" style="width:100%; padding:5px; background: #ffffff;">
YOUR ADSENSE CODE, AFFILIATE LINK OR BANNER HERE
</div>
<?php }?>
- Be sure to mark Execute Shortcodes on this hook and Execute PHP on this hook
The part in red is the conditional statement that tells the ad not to appear on single posts and pages. So, this appears on the home page and all archive pages and with this implemented the right way, you won’t be having more than three ad units on each of your site pages. You can even take this further if you’ve done PHP programming or any sort of programming before. It’ll be much more easier for you to manipulate this statements and make your ads appear exactly where you want them to be.
3. Below post title
Now we’re going to add adsense below post title and we’re still gonna use Simple Hooks and conditional statements. The first time I did this, the Google Adsense ads appeared on archive pages and the home page till I added a statement that forced the ads to appear on single posts and pages only.
- Go to Genesis Simple hooks settings page and find genesis_before_post_content Hook
- In the box, paste this code:
<div align="center" style="width:100%; padding:5px; background: #ffffff;">
YOUR ADSENSE CODE, AFFILIATE LINK OR BANNER HERE
</div>
<?php }?>
- Also, mark Execute Shortcodes on this hook and Execute PHP on this hook
The part in red tells the advert to appear on single posts or pages. It’s gonna be hidden from the homepage and archive pages and I’m sure you don’t wanna show it there, do you?
4. After post content
You’re still using the same code you used right above but you’re only going to add it to a different position, OK?
- Search for genesis_after_post_content Hook
- Paste the code up there in to the box and save.
You’ll probably notice that the post meta (tags and categories) appear above the advert. You can reposition this by marking the box that says Unhook genesis_post_meta() function from this hook?.
- Below the code already in the box, now add this:
genesis_post_meta()
?>
5. Above posts in archive pages
Still tweaking the conditional statements, we can make ads appear on archive pages only. This include category pages, tag pages, author pages and so on.
To make ads appear directly above posts on archive pages:
- go to Genesis Simple Hooks settings page and search for genesis_before_loop
- Paste this
<div align="center" style="width:100%; padding:5px; background: #ffffff;">
YOUR ADSENSE CODE, AFFILIATE LINK OR BANNER HERE
</div>
<?php }?>
There are lots of other positions you can add your codes, you only need to study genesis hooks deeper and learn more about WordPress conditional tags. With this, you can show or hide ads or custom PHP / HTML where ever you want in your Genesis theme.

Twitter: Donjos10
says:
Hey Your Brain Has Been Over floated.Thanks Alot.Bye bye to mobilepress.Gonna Get it a Try
Twitter: mavtrevor
says:
Simple Genesis Hooks is an awesome way of adding anything to a Genesis theme without using plugins, if you understand the hooks properly as have been explained here, you can easily add anything to your Genesis theme, i have been using it and i can tell its an awesome plugin.
Nwosu Desmond recently posted..Understanding Search engine ranking factors
Twitter: xlimderek
says:
Thank You,
Got my own working already, no need of post layout plugin anymore.
Derek recently posted..How To Dowload All Your Facebook Pictures And Data With One Click
Great! one less plugin to worry about
Twitter: techarta
says:
What a timing! You put up this post at the right time. I in fact wanted to replace my Awesome ads plugin by manually putting up codes using genesis hooks. Any idea on how to put up ad on the 404 error page?
Also would like to know the HTML code for aligning a bit towards rightside from center in the following code –
nikhil recently posted..Microsoft Reportedly Developing a Mini Gaming Tablet
At the end of 404 pages? I’m not sure I have an idea how to get that done. I can’t see the code you posted. Can you parse it here before posting in the comment box?
Twitter: techarta
says:
Hi,
The code is:
<div align="center" style="width:100%; padding:5px; background: #ffffff;">
nikhil recently posted..WinX DVD Ripper Platinum Free License Giveaways For All
You only need to change
align="center"toalign="right"Also, for the question you asked about adding something at the end of 404 pages, you may need to directly edit the file located at public_html/wp-content/themes/genesis/404.php
I eventually took a look at the files in Genesis and found it.
Add your custom code after
<!-- end .postclass -->Don Caprio recently posted..A List of VoIP Phone Service Providers
Twitter: techarta
says:
Hi,
Align right brings it too much towards right. I just want slight movement towards right from the center.
Anyway, Thanks for the 404 page tip!

nikhil recently posted..Apple’s iCloud Problems
Twitter: Boygalaxy
says:
@don you are the boss.. can this work for mobile ads? i’m used to post layout plugin for displaying ad on my mobile version.. After a while i observed that the post layout plugins displays ads on mobile when your operamini is set to desktop view,and doesn’t show when set to mobile view…i Guess the genesis hook can solve my problems. So my ads can show for both
It should work. I also use this for mobile ads.
Twitter: Boygalaxy
says:
Okay boss. This is a nice post i must confess
Prince recently posted..Download Chelsea FC Theme for Blackberry
Twitter: cuteblogdesigns
says:
Thanks for this! I have tried using plug-ins but would rather do it this way!
Anyways, I followed the directions above and some ads are showing up on pages and I only want them on posts (after post content). I added the code to “after_post_content” hook but I don’t want it to display on pages.
Is there a filter, or way to exclude the ads on pages?
Here is a link to a page its showing on:
http://blogaholicdesigns.com/shop/
I only want the ads on my blog posts.
Your help would be greatly appreciated!
Thanks!
Emily recently posted..Free Fall Blog Templates- Backgrounds-Buttons!!!!
Hi Emily,
Yes, that’s possible. Just change
<?php if ( is_page() && is_single() ) {?>to this:<?php if ( is_single() ) {?>That should limit it just to single posts.
Twitter: cuteblogdesigns
says:
You have no idea how much I appreciate it! That worked perfectly! I use a lot of your tutorials and I just wanna let you know I think you rock – you’ve saved me a lot of time!
Thanks

Emily recently posted..$40.00 Premade Blog Template Collection!
The pleasure is definitely mine. Glad you got it working
Kind regards.
Twitter: soccer4life133
says:
Plz am using the dynamic view for my Blogger blog. I don’t konw how to paste Ad codes in my blog.
When i tried pasting one code in my Edit HTML in the eidt template section my account was deleted.
Plz i need your assistance.
This post is actuall for WordPress, Genesis framework specifically. Why not disable dynamic view and use the regular layout?
Worked great , Don.
Many, many thanks.
I had been looking at a number of options for achieving this(placing ads below header and / or after posts)…and many tutorials I followed caused issues for my site…then I had to go into my Host account file manager to clean it up….
Though, your simple hooks instruction only needed a few page refreshes and it is working beautifully..
It works for me when I “don’t ” tick execute short codes and execute PHP, though I am not complaining….
Thanks again…
Danny recently posted..Your Vision For Achieving Blogging Success
Twitter: ann_donnelly
says:
Thanks so much! Been searching for the right example to do just what I want to add text at the bottom of pages and posts only and I finally found it here!
Twitter: doncybertips
says:
nice post in here man
doncyber recently posted..Considering Which One is Better – WordPress or Blogger?
Twitter: doncybertips
says:
@ don…. I will like to paste ads side by side on the same spot as you did yours
doncyber recently posted..Considering Which One is Better – WordPress or Blogger?
You can either float the using CSS or use HTML tables.
Twitter: healthabeHQ
says:
Please explain how to put the ads side by side and for the sharethis code in the other post, mine appear at the homepage WHY?
Twitter: healthabeHQ
says:
Bro Mine Always appear on the Homepage why
Kingsley recently posted..Vitamin A: Vitamin Deficiency Diseases
Twitter: hebbarjv
says:
Hi, can you please tell me, in Gensis theme –
how to insert adsense ad, below title, right alligned to the post content. I want the ad to be wrapped within the post. I do not want it between the title and the post.
You have to put your adsense in a css class to float it to the right:|
<div style="float: right; padding: 5px; margin: 5px;">
ADSENSE CODE
</div>
I am looking for the code to put a 728×90 banner under the logo in Genesis framework news theme.. Is there any body can help me..
Mellisa Miller recently posted..How to understand credit scores better
You can check this, Mellisa. Adding Google Adsense Leaderboard / Banner Below Header in Genesis
Great one
Thanks a ton…
Karthikh Venkat recently posted..Top 5 Degrees Preferred by Indian students
Twitter: xandulyn
says:
Although I have had my adsense account approved over a long while now, I just requested for it to serve on my blog as at 14 hours ago. I was instructed to put the code in my html, so it can be activated.
I have as well followed the instructions you posted to add my adsense codes, but up till this second I haven’t seen any ads serving on my blog.
How long does it take to start displaying ads, and is there something I havent done right?
Thanks for this great piece.
Selfmadecash recently posted..Event Planning Business And How To Handle Vendors Better
Twitter: omoscowonder
says:
Selfmadecash, that’s correct, your impression first will matter alot, if your impression is okay, live ads will start being displayed on your blog.
wish you the best.
Make Money Online writing articles recently posted..How To Make Money Online Writing Articles
Twitter: michelle7508
says:
Thank you so much for this helpful post! I’m not very knowledgeable about PHP, but have an ad that I would like to use below the post title on pages and posts, however I don’t want it showing on the archives nor on a few specific posts. I thought I was using the correct conditionals, but the conditionals to have the ad not appear on archives or the specific posts doesn’t seem to be working. Can you offer any advice? Here is the code I was trying:
<?php if ( is_page() || ! is_archive() || is_single() || ! is_single( array( 17591, 17577, 18390 ) ) ) {?>
Thank you so much again!
Michelle recently posted..Easter Word Search #1 – Free Printable
I guess this should work:
<?php if ( ! is_archive() || ! is_single( array( 17591, 17577, 18390 ) ) ) {?>
Twitter: teevibes
says:
Please can this help in displaying adsense mobile ads too?
On Genesis? You can use PHP include function as explained here: Inserting Google Adsense, Inmobi and Admob Ads in WordPress Mobile Version
great tutorial. i was just looking for the solution of putting the code on multiple places and your tutorial just helped me out. really genesis hooks rocks…
Twitter: healthabeHQ
says:
D.c please how can i make the ads appear but on archive and category pages like your and align it left and right??
Kingsley recently posted..How To Add the Twitter Flying Bird To Blogger?
<?php if ( is_archive() ) {?>
AD CODE 1
AD CODE 2
<?php }?>
That goes into genesis_before_loop Hook
Twitter: atikcse1992
says:
Thanks for nice post.
How to add Google Adsense code without plugins?
atiqur rahman recently posted..The usefulness of e-mail for students of Bangladesh
Twitter: mybloggerblog
says:
Great post! it was very helpful post for me.
thanks for shearing.
atik recently posted..Free Download Premium Studiopress Genesis Framework Version: 1.8.2 and 1.9.1
You can check this out: How to Add Google Adsense / HTML Codes to Genesis Without A Plugin