Show Adsense ads after Post Title & Contents in Genesis Theme
Updated On May 23, 2015 March 11, 2014 -Written ByDisplaying advertisements before and after actual article content is a must for majority of blogs and websites. Genesis child theme users can easily add new widget section below post title (before post content) and after the post content to show ads in these areas. Once you add new sections, just use add text widget to those sections and paste any code that you want to display. Besides the usual ad code, you can insert code to display social icons or use any other widgets in those sections like recent posts, search, comments etc.
1. Add ads below Post title on single Posts
Add following code to functions.php file. This code will register and create new widget “Ad After Title” in the widgets area.
https://gist.github.com/9482064
Once you add the code, goto widgets area and drag text widget to “Ad After Title” section. Then paste your Adsense ad code or any other advertisement code to that text widget.
The added advertisement will only display below post title on single posts. You can also customize the look of this ad code section by adding following code to your style.css file.
[cc]
.ad-after-title {
background:#f4f4f4;
margin:10px;
padding:10px;
}
[/cc]
2. Add Ads at post content end on single post
Add following code to functions.php file. It creates new “Ad After Content Area” widget in the widgets area. Now goto widgets aread and drag text widget to “Ad After Content Area” widget section. Then paste advertisement code, social icons code, simple text or anything that you want to display after post content on single posts in the text widget.
https://gist.github.com/4547115
Similar to above, you can customize look of this section by adding “ad-after-content” class to style.css file. You can begin by adding following code to style.css and then customize it further as per requirement.
[cc]
.ad-after-content {
background:#f4f4f4;
margin:10px;
padding:10px;
}
[/cc]
Nice tutorial……………….thanks for share.
Parse error: syntax error, unexpected ‘=’, expecting ‘)’ it says this can you email me if you sort it out? I have the latest php version on my server.
‘id’ => ‘after-post-title-ad’, this is the line causing the error
Hi,
Thank you so much for the useful post.I wanted to know How can you place the ad to the centre below the post title.
Regards,
Joel
In the CSS Code add following to make it center align:
text-align:center;
float:center;
great tutorial. I just want to ask if I put the widget on a page would i use the same code?
Any idea how to add TWO widgets, side by site after the post in Genesis? I’ve see that on Copyblogger website before they re-designed the site. I would use one for related posts or sign up form and the other for AdSense or other ad network.
this is great ! so I can stop depends on plugin to add the code, thanks so much!
Thanks for the tip. Between, is it possible to add “Advertisements” text just above the add? I tried to use the following code in the Ad after title widget but somehow Advertisements text isn’t appearing.
Just add text advertisement before the ad code – it will appear above the ad by default
Worked like a charm! Shame I did not find this sooner. Broke the website a few times before finding this. Bookmarked and saved for future projects thanks to the editor
thanks bro gonna try
Only this article is useful.
Working 100% on genesis theme..
Awesome ! keep working :D
Thanks A LOT!!! Very nice and absolutely useful.
He works great. I got rid of a big trouble. It’s really a boon. Thank you