How to set Adsense WordPress header



Long time ago wanted to write this post How to set Adsense WordPress header, but lately I was very busy with my websites. Well now I have a free time and I will write. After installing a WordPress theme, we always want to modify something to your liking to put a banner ad on a specific site in header or any type of image, for example a logo. You can do this in two ways. First, it is – in the theme settings, many of the themes allow you to do this through the admin panel. We insert the code of your ad in a special field, and we save and enough, and  publish banner is already in the header . But what to do if the theme configuration does not have this option? Do not worry, you can add your ad code manually. As they say, the eyes are afraid, but the hands are doing. In the next paragraph the second method. Complex here, nothing. Let’s proceed.Adsense WordPress header

How to set up Adsense WordPress Header

In order to display the ad unit or any banner in the header of your blog you have to go to the “Appearance” – “Editor”. Open the file “Header” (header.php) in the topic. Find a place where the name of your blog (or logo) or the description of the blog is displayed. Then, for your ad code you must assign a class. It is necessary for the next step – the desired position of the banner in the header of the blog:

As you can see in my case class is “ad1”, can indicate any, for example like: “banner”. All this code construction is inserted just below the lines that are found (see above):

<a href=”/”> <img src = “<? Php echo stripslashes ($ gpress_logo_url); ?> “Alt =” <? Php bloginfo (‘name’); ?
<? Php} else {?>
<a href=”/”> <span class = “lcolors”> <? Php echo stripslashes ($ gpress_logo_text_color); ?> </ Span> <? Php echo stripslashes ($ gpress_logo_text_black); ?> </a>
<div class = “desc”> <? Php bloginfo (‘description’); ?> </ div>
<div class = “ad1”> <script async src = “// pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”> </ script> 
<! – Claim -> 
<ins class = “adsbygoogle” 
style = “display: block” 
data-ad-client = “ca-pub-xxxxxxxxxxxx” 
data-ad-slot = “xxxxxxxxx” 
data-ad-format = “auto”> </ ins> 
<script> 
(Adsbygoogle = window.adsbygoogle || []) push ({}); 
</ Script> </ div>

– the banner code after  php bloginfo (‘description’); ?> </ Div>

Also read :  Email Marketing Benefits

                   Small Business Industries 6 easy Social SEO Tips

                   How to Make Money Online by Blogging

As you can see I put the banner code after the “title” of my blog. We update file. Now you have a banner that appears in the header of the page (in the middle), but you need to specify the place where it should be, in my case it is to the right of the blog title. For this we have to use CSS style file. Open the file “Style Sheet” (style.css) and at the end of the file add a small CSS code, which will say the coordinates of your banner:

In this code, the location of my banner is specified for my WordPress theme. All the themes are different, so you have to play with the numbers. Where:

.ad1 – the assigned banner class;

Padding – allows you to set the field size to all sides of the item immediately;

0px – the distance from the top edge;

0 – the distance from the lower edge;

0 – the distance from the right edge;

550px – the distance from the left edge.

You can try using this code (if the first code suddenly does not work, it depends on your wordpress theme):

.ad1 float right Margin 10px 10px 0px 0px }

Set the borders and you get the beautiful location of the banner in the header of the blog. I think now everything is more or less clear how to set up an advertising banner in the WordPress header.

A greeting.

NOTE: Currently I do not use the banner in the header because it seems to me little effective. In my opinion it is better to enter the ads within the articles or blog posts .

If you liked Basic guide for Adsense approval for beginners articles , so please subscribe to our WebStaffs.com Blog. You can also find us on Twitter , Facebook LinkedIn , Google+ and Tumblr.




Be the first to comment

Leave a Reply

Your email address will not be published.


*