How to Add Adsense ads inside wordpress Blog without Using Plugin

T2tkid

Elite Member
Joined
Oct 13, 2010
Messages
5,019
Reaction score
2,479
How do i add adsense ads without using plugins?
Thanks.
 
Simple hardcode it into the theme.
 
Depending on where you want it...I use a div tag. For instance, say you use the 250 x 250 block. Without the brackets, just in case this forum blocks html: div style="width:250px; height:250px; margin:8px; float:left;"> YOUR ADSENSE CODE HERE /div>

Something like that should do the trick for you.
 
Okay, where do i insert this code?
Header or footer?
 
Hey very easy buddy,
Go to widgets then add "TEXT" to your sidebar and put your adsense code there, it will work only for sidebars.
For header and footer, go to your theme folder then find header.php and footer.php and insert your codes there.
that's it :)
 
let say i want to include it in every post i make automatically ??

how should i go about doing it?
 
Here that is what i want to know, how do i add adsense ads INSIDE POSTS?
I have it in my sidebar.
 
Here that is what i want to know, how do i add adsense ads INSIDE POSTS?
I have it in my sidebar.
1) Open your index.php in notepad.
2) Find something like this:
Code:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
3) Put your adsense code right below.
4) Do the same with single.php and archives.php if you have them.
5) Upload the modified theme to your /wp-content/themes/
6) Enjoy!
 
Cyberseo
should i copy and post the adsense codes inside the index.php?
Or use something like this:
div style="width:250px; height:250px;margin:8px; float:left;"> YOUR ADSENSE CODE HERE /div>

thanks.
 
If you want to put it right below the post, you don't need any div's there.
 
@op

goto the theme files(not root index.php), goto wp-content/themes/yourtheme ...

there you will see the files ... index.php, header.php, footer.php, page.php, single.php ...
header is the same for the whole site, so if you want a sitewide google ad somewhere in the header area, you have to edit the header.php and code the ad code, and position it using div tabs, margins etc ..

Same with the footer, footer.php is same for the whole site....

single.php is the template for POST, if you want an ad to show up in all the posts, edit this file, and drop the code accordingly.

page.php is the template for a PAGE, the ad will show in all the pages ...

If you want to put an ad in the sidebar, you can use the text widget in the widget section...
 
@CyberSeo
I want to add the ads inside the post. Not below the post.
Thanks.
@_chip_
thanks for your tutorial, but my theme don't have single.php, any other idea where to place the code?
 
The google adsense ads will be inside the post, either by the right or left.
Or below the title of the post.
 
Step 1: Login to your blog as administrator
Step 2: Click on Appearance
Step 3: Select Widgets
Step 4: Select the sidebar you want (Default Sidebar 1)
Step 5: Add Text widget
Step 6: Click on Edit widget
Step 7: Enter Caption. I have used ?Useful Links?
Step 8: Paste your Google Adsense code in the text area. See example code
 
I shouldve clarified my code above...my code was to put the code IN the post, and if you put my code in your post first, then write your content (remmeber to put my code in the HTMl section), then your adsense will be top-left and your content will wrap around it. Also keep in mind I didnt post some of the brackets such as < >
 
Step 1: Login to your blog as administrator
Step 2: Click on Appearance
Step 3: Select Widgets
Step 4: Select the sidebar you want (Default Sidebar 1)
Step 5: Add Text widget
Step 6: Click on Edit widget
Step 7: Enter Caption. I have used ?Useful Links?
Step 8: Paste your Google Adsense code in the text area. See example code

Did not worked for me, just pasted the code but it does not show up :/
 
Back
Top