I created this simple, easy going tutorial on how to place google adsense or any other html code, javascript advert side by side [same horizontal width] on the home page ( Below Pagination) archive page (below pagination) single page (after comments, before the footer) pages ( before footer ) of your Genesis Powered wordpress blog irrespective of the child theme without using any special plugin.
But since my blog runs on the already popular eleven40 like custom child theme – genesis framework I decided to use it as the basics for this tutorials. I have already tested this on the eleven40 child theme, magazine child theme, prose child theme, redpress theme on the thesis framework, freshlife 2.0 theme-junkie theme and the magpress premium news theme.
So I don’t see any reason while this simple tips on How to Place Google adsense side by side in genesis / wordpress without using a Plugin shouldn’t work for you . I even tried it once in blogger.com cms using this trick , this is to assure you that it can be used any were so long as you know what you are doing.
Now let’s go to the main details on how you can easily Place Google adsense side by side in genesis / wordpress Playing around various position of your choice without any particular wordpress plugin. Now while this basic tutorial will be focused on doing this without any plugin at all I will still Consider our readers who have got the Genesis simple hook Plugin installed already that is for those of us that are using the genesis framework for our wordpress blog or that plans installing the plugin in the future. The flexibility and zero server effect of the genesis simple hook plugin has made it act like a core integral part of the genesis framework. Others not using genesis for their blog can quickly grab the quick adsense plugin it works flawlessly like the genesis simple hook with almost same flexibility.
Adding Google Adsense or any other Adverts Side by Side In Genesis Framework Without any wordpress plugin at all
Placing the double squared Google adds [ same horizontal width ] below pagination in the blog homepage only:
- For neutral persons who love mixing php with basic html
Log in to your admin dashboard, go to Appearance ==> Editor ==>Select theme functions (functions.php) ==> copy and paste this code in the last line of your function.php ===> N/b we are using the 250*250 adsense (bidvertiser, media.net yahoo-bing adds, chitika, snowmotion, addynamo and etc.) Unit so your css padding should reduce if you are using any unit higher than this let’s say maybe 350*280 .
/**
obasimvilla.com/placing-google-adsense-side-by-side-in-wordpress-genesis-without-using-any-plugin-how-to
*/
function ad_after_endwhile() {
if ( is_home() ) {
?>
<!-- Obasimvilla.com custom BEGIN -->
<div align="center" style="width:100%; padding:10px; background: #ffffff;">
<table>
<td>Your 250*250 adsense Single Unit Code</td>
<td>Your 250*250 Chitika Contectual adds code</td>
</table>
</div>
<!-- Obasimvilla.com custom ends -->
<?php
}
}
add_action('genesis_after_endwhile', 'ad_after_endwhile');
Replace Your 250*250 adsense Single Unit Code With your own adsense, same for Your 250*250 Chitika Contectual adds code remember that you can flawlessly use google adsense and chitika in the same horizontal width. you may stick with adsense unit 1 | adsense unit 2 if that is what you want.
- For Php addicts who feeds on code snippets only
Repeat the first action above as in
Log in to your admin dashboard, go to Appearance ==> Editor ==>Select theme functions (functions.php) ==> copy and paste this code in the last line of your function.php ===> N/b we are using the 250*250 adsense (bidvertiser, media.net yahoo-bing adds, chitika, snowmotion, addynamo and etc.) Unit so your css padding should reduce if you are using any unit higher than this let’s say maybe 350*280 .
/**
obasimvilla.com/placing-google-adsense-side-by-side-in-wordpress-genesis-without-using-any-plugin-how-to
*/
function ad_after_endwhile() {
if ( is_home() ) {
?>
<!-- Obasimvilla.com custom BEGIN -->
<div align="center" style="width:100%; padding:10px; background: #ffffff;">
Your 250*250 adsense Single Unit Code
Your 250*250 Chitika Contectual adds code
</div>
<!-- Obasimvilla.com custom ends -->
<?php
}
}
add_action('genesis_after_endwhile', 'ad_after_endwhile');
Repeat the second step above as in:
Replace Your 250*250 adsense Single Unit Code With your own adsense, same for Your 250*250 Chitika Contectual adds code remember that you can flawlessly use google adsense and chitika in the same horizontal width. you may stick with adsense unit 1 | adsense unit 2 if that is what you want.
Placing the double squared Google adds after content in post & pages without any plugin at all:
Repeat the necessary steps and use this code adding it in the last lines of your functions.php
/**
obasimvilla.com/placing-google-adsense-side-by-side-in-wordpress-genesis-without-using-any-plugin-how-to
*/
function ad_after_posts() {
if ( is_page() || is_single() ) {
?>
<!-- Obasimvilla.com custom BEGIN -->
<div align="center" style="width:100%; padding:10px; background: #ffffff;">
<table>
<td>Your 250*250 adsense Single Unit Code</td>
<td>Your 250*250 Chitika Contectual adds code</td>
</table>
</div>
</div>
<!-- Obasimvilla.com custom ends -->
<?php
}
}
add_action('genesis_after_post_content', 'ad_after_posts');
Placing the side by side adds after all comments in post without any plugin at all:
Repeat the necessary steps and use this code adding it in the last lines of your functions.php
/**
obasimvilla.com/placing-google-adsense-side-by-side-in-wordpress-genesis-without-using-any-plugin-how-to
*/
function ad_after_endwhile() {
if ( is_single() ) {
?>
<!-- Obasimvilla.com custom BEGIN -->
<div align="center" style="width:100%; padding:10px; background: #ffffff;">
<table>
<td>Your 250*250 adsense Single Unit Code</td>
<td>Your 250*250 Chitika Contectual adds code</td>
</table>
</div>
<!-- Obasimvilla.com custom ends -->
<?php
}
}
add_action('genesis_after_endwhile', 'ad_after_endwhile');
Use this code format to toy with any position of your choice playing around the conditional statements contained in wordpress and the genesis framework Just make sure you are getting it all right after all you have the freedom to ask me any questions if you run into any error at all.
How to Place this kinda ads Using the Popular Genesis Simple Hooks Plugin:
I will not write so much on this one since the genesis simple hook plugin has already proven itself to be self explanatory, just make use of the codes above applying the conditional statements where and when necessary.
- Head on to wordpress plugin repository to grab the Genesis Simple Hook Plugin
Or search it from your wordpress dashboard using the plugin search option, install and activate following the wizard UI. Now proceed with the tutorial to grab a single sample code to use while using the genesis simple hooks plugin.
Placing the double (side by side) google adds Below Pagination-Before the Footer Widget Area Using Genesis Simple Hooks Plugin:
Shows in the homepage, single, archive, pages and etc. To add your custom code do the following, bearing in mind that you can place one google adsense unit (let’s say 250*250) in one of the horizontal bar and chitika adds ( 250*250) in the second horizontal bar . Also take a look at the conditional statements, I added all of it to make it easy for you to remove the ones you don’t like or add the ones (formats) you might need. Also play around other possible adverts position taking full advantage of the genesis framework simple hooks plugin’s flexibility.
Log in to your admin dashboard as usual, go to Genesis ==> Simple Hooks ==> Locate ==> genesis_after_endwhile ==> copy and paste the code below ticking (checking) the following boxes ,,, ,,,, Execute PHP on this hook?,,,, that’s all .
Here is the code to copy
<?php if ( is_single() || is_home() || is_category || is_archive || is_page || is_front_page ) {?>
<div align="center" style="width:100%; padding:6px; background: #ffffff;">
<table>
<td>Your 250*250 adsense Single Unit Code</td>
<td>Your 250*250 Chitika Contectual adds code</td>
</table>
</div>
<?php }?>
or this second code! just any one of your choice
<?php if ( is_single() || is_home() || is_category || is_archive || is_page || is_front_page ) {?>
<div align="center" style="width:100%; padding:6px; background: #ffffff;">
Your 250*250 adsense Single Unit Code Your 250*250 Chitika Contectual adds code
</div>
<?php }?>
Bonus Tips :
You can do a lot of styling on these adds unit placement you have just added via the genesis actions, just define a class in your default theme style.css or use the custom css for those of you using the jetpack official wordpress plugin by automatic. Then remember the class you have created and call it in the first div in any of these codes just along the lines where you have <?php if ( is_single() || is_home() || is_category || is_archive || is_page || is_front_page ) {?>
<div class=”your class should replace this “align=”center” style=”width:100%; padding:6px; background: #ffffff;”>
Your 250*250 adsense Single Unit Code Your 250*250 Chitika Contectual adds code
</div>
<?php }?>
Concluding Lines :
We have played a lot with genesis plugin, actions, conditional statements and sundry not forgetting the fact that most of our Loyal Readers are using wordpress themes other than the genesis / thesis framework. This is while I will be writing another tutorial in the next few seconds that will cover other wordpress themes, just didn’t want to make this unnecessarily longer than it is.
Feel free to drop your valuable comments
Even if “Insert Adsense” plugin hasn’t been updated
in more than 2 years, it is a plugin that works perfectly for me.
In the last few days I wanted to change my main add
on each page from a small one to a big one, and by only changing the HTML at
Insert Adsense, all my pages changed at once. The other adds, stayed the same.
It does exactly what it proposes…and works perfectly
on my bilingual site.
Simple and great plugin.
and is there anyway one can use this trick on mobilepress???
This is a great job bro its working well like madt thanks bro
Thanks for dropping by Tobi, your valuable comment is very much appreciated
this is working like magic on my blog…. i cant wait to tell you to have a look at your good job on my blog OBASI
Thanks for the compliment don, that was really very brilliant piece of art you ‘ve gat there
Thank you for taking the time to write this tutorial and am sure a lot of people will find it interesting. and also you made the steps so easy to implement. am going to add adsense and chitika ads on my blog now. thanks.
Thanks for taking your valuable time to drop this feedback, thanks a lot
You did a great work here by posting this tutorial.
Thanks for dropping by bro, you valuable feedback is well appreciated
Very useful tutorial, but afraid of touching my functions.php. I would try the simple hooks thing.
Thank you for explaining.
Though either ways should work flawlessly for you I will still advice you continue with the use of the genesis simple hooks plugin
Nice post…nw i cn use addynamo side ways wit it.
Nice post Bro Obasi and thanks for tagging me all the way from facebook to gain from it
You are welcome Tobi, it really helps getting this valuable feedback