Adding Adsense Code to WordPress Thesis Theme

I am experimenting with Thesis, a premium WordPress theme- and really it is more than a theme- its adds incredible functionality to your WordPress site. If you are a beginner it might be overwhelming but if you know coding or can handle modifying your word press theme it is fairly easy to learn.


Now, having said that.. I REALLY struggled getting a very basic task done with Thesis. There is no “single.php” or “index.php” and the css styling is handled a little differently that usual themes. I was pretty surprised on how difficult this was to find out how to do- either there is a way others are doing and I am new and ignorant or my skills are not what I thought they were!
I will cut to the chase and just give you the codes

How to add Adsense Code To Header of Thesis WordPress Theme

By far this was most difficult to solve and took me a good 2 hours to get Adsense code working and the way I wanted it into header of Thesis.

You need to edit custom_functions.php file and custom.css . you will find both in “custom” folder in the Thesis theme directory on your server.
If you haven’t changed name of file folder “custom-sample” in Thesis directory change it now. You need to do this through an ftp client ( like FileZilla )

You can edit the file either directly on the server ( and for the love of god do NOT ignore my BACKUP YOUR FILES warning!! ) or through WordPress interface.

To put Adsense code in the header the way *I* like it is a 728×90 leader board under the title/image/taglines of my blog.
You can use other code- link units or half banners as well.

So… to add Adsense Code to your header in thesis UNDER header here we go:
Create your ad in Adsense. Copy the code it gives you.
Add following to custom_function.php file:

function header_ad() { ?>
<div id="header_ad">
<p>
ADD YOUR ADSENSE CODE HERE
</p>
</div>
<?php }
add_action('thesis_hook_header', 'header_ad');</blockquote>

Next we need to edit the style.css file in “custom” folder.
This code works perfectly for me- centered and aligned perfectly for my site. You may have to change values for yours- its not that hard. Just change numbers and see what it does. If you want to place ad along side of title or title image use “-” sign in front if the first value. try -60 first and go from there.
So, simply copy and paste this code into your style.css sheet:

/* HEADER ADSENSE */
.custom #header_ad {
margin: 10px 0 10px 0px;
}

and that’s it! Hope this saves people the headaches I had doing this :-)

How to Add Adsense Code to Thesis Below Post Title

This was slightly easier and you don’t have to add anything to style.css.
I use either a half banner or link units under the post title.
Create your ad.
Copy the code into custom_funtions.php file where indicated below.

function before_post_ads() {
if (is_single()) { ?>
YOUR ADSENSE CODE HERE
<?php }
}
add_action('thesis_hook_before_post', 'before_post_ads');

Add Adsense Code To End of Post in Thesis WordPress Theme

function after_post_ads() {
if (is_single()) { ?>
Your Ad Code Here !
}

add_action(‘thesis_hook_after_post’, ‘after_post_ads’);

Fix Adsense Deluxe WordPress Plugin : You do not have sufficient permissions to access this page


After upgrading my wordpress plugins I have been getting the very annoying “You do not have sufficient permissions to access this page” error when trying to get ing Adsense Deluxe plugin settings.

The plugin in is pretty old- I have been using the SAME version since 2003 !
To get rid of the error takes just a couple of minutes.

1. You need to de-activate the plugin
2. Edit the plugin in either with your FTP client or within wordpress ( under Plugins-> Editor-> and choose Adsense Deluxe from dropdown menu
3. Find admin_head and change it to admin_menu and update.
4. Re-activate plugin and the You do not have sufficient permissions to access this page erore will be gone.

I still have not found woraround that will show the Adsense Deluxe options when wrting a post – if anyone knows solition would love to have it!

Sudden Drop in Adsense Earnings? Site Traffic Dropped? WordPress Blog Hacked?


First sign for many site owners is that there web site or blog has been hacked is a sudden or dramatic drop in there ad sense or affiliate earnings.
I noticed something was wrong when because my WordPress admin panel wasn’t doing what it should have done. Suddenly I couldn’t add new categories in wordpress.
Functions didn’t work properly- I wanted to mass delete users and the drop down menu wouldn’t work.
I would be approving comments and a mouse hover would suddenly reveal random spammy text.

Help ! My website is being redirected to… uniqtext.com or similar spammy sites

One particularly evil hack is random re-directs of your site in Google search engine results ( SERPS) . Usually your most popular posts.
Your pages may being redirected to sites like uniqtext.com.
Hard to catch this one as if you have a cookie from your site the redirect won’t happen- only new visitors will be redirected to the spam site uniqtext.com with this hack.
You can clear cookies and do a search and try.

Repair Your Hacked WordPress Blog

I want to mention here if your site has been hacked initially it can be overwhelming and you might be tempted to something rash- like deleting files, etc. Its important you stay calm and act in rational manner. You may need information from the file you just deleted permanently.
I can assure you that you can fix your site and eventually it will be okay. Just take your time and do things step by step.

Using Web Master Tools to Catch WordPress Hack

Another way to catch a hack is to regularly check your site in Web Master tools ( you need to have a Google Analytics plugin installed your WordPress site) you can add your site and see problems- like pages not found, pages that don’t exist, etc. Look under “diagnostics” on your site’s dashboard in Web Master Tools.

webmaster tools home page diagnostics

Examples of Hack Code in WordPress Site

Hackers infiltrate your unprotected or out dated word press blog through ftp or as a user.
First thing to check is you current wordpress theme. A hack may be in all of the files or just header or footer.
You may find code that looks something like this:

example of hack code in wordpress evel(base64_decode…

ugly isn’t it?
If you have hack code in your wordpress theme also check ALL your other wordpress php files. Start with function.php and likely you’ll find hack code there as well.

First Steps to Fixing Your Hacked WordPress Site

This is what I have done when finding the code.
Downloaded my entire site onto hard drive. everything in the root directory.
Backed up my wordpress blog. You can either use a wordpress plugin- like this one to back up or manually export the tables in MyphpAdmin.

Change passwords for FTP client, wordpress admin passwords, and your MySQL database password. ( this is usually done in control panel where you host your site). You don’t want hacker coming in behind you as you clean up.

I would also create a ” Site down for maintenance” file. You can just create simple index.html file and upload to root of server.

Looked on hard drive for CLEAN backed up copy of site ( which most people won’t have) or a clean copy of theme.
If you don’t have clean copy of theme I would start cleaning hacked of theme or i consider downloading fresh copy and starting from scratch.
I am comfortable cleaning the them myself- basically delete the hacked code ( if you aren’t sure download clean copy of theme and compare) Likely the code will be at very top or very bottom ( scroll down past any white space)
You can edit files in ftp or do manually. Be very careful when editing- its easy to accidentally delete a snippet or character that your theme needs.

This is what i did instead of just deleting the entire directory for my site which seemed seemed scary. I created a new directory for site with intent to delete infected directory after new one was all was set up. I am talking about directory on your server, where you upload files and wordpress files sit. I created new directory to upload fresh install of wordpress and cleaned files. In control panel you will be able to point the domain to the new directory. You can always change name back after you delete infected directory.
In my control panel for my sites ( site host i.e. dreamhost, go daddy, etc) .

Upload fresh install of WordPress and for the love of god make sure it is most recent.
Go through INFECTED files cleaning what you need. You will need your images for example.

WordPress Hack in Image Files and Directories

On that note- look through ALL your image files and directories. You may find more hacked code! Might be buried in a file with innocent name like ” log” . I recently found over 2,000 spam html files buried in image folder. Look for weird names that you know you didn’t create. If you are at all unsure don’t delete than at first but don’t upload them either.

At this point you should have fresh install of wordpress. Your theme cleaned and uploaded. Likely all your themes have been hacked so please delete or clean others before uploading or don’t upload at all.
Your plugins have likely also been hacked, Check them for hack code.
I would re- download all your plugins and not take risk of messing with the plugin code or missing hack code.
Upload images and other files you site need. I would do this very carefully. Don’t just drag “images” folder over in your ftp client to upload-check each directory,etc.
Test that your site is working. Activate plugins one by one. Look at posts to make sure images are working.

WordPress Hack has changed Permalinks, Categories or Site Structure

Chances are if your site has been hacked it has affected site structure and the way Google sees your site. It may have been labeled suspicious. It some cases it affected your permalink structure. On one of the sites I fixed the a hack it had changed all the wordpress categories.
Go through your posts and check that this hasn’t happens. Look for lots of posts that are “uncategorized” and assign them to a category. while you are at it add some tags as well.

How to get Site Re-indexed After WordPress Hack

Once you are sure your site is clean and working properly take some steps to get your standing in Google back and your site indexed properly.
Use a plugin that will help with crosslinks ( i.e. related posts plugin , similar posts)
These plugins in will add links to similar posts after post and create instant crosslinks that make sense. You can change how many related posts you want listed. If you want to be aggressive set to 10. More restrained use 5. Normally I would have set to 3.

Add fresh content. Fresh content will bring bots which is what you want.

Update older posts. Again will bring bots.

If you don’t have Google sitemap plugin on your blog get it.

Use Google Web Master tools and Google fetch. You can use these tools to have your site and pages crawled by Google bots. I some cases your site may have been de-indexed by Google. make a request for re-inclusion of your site.

Take steps to Make sure it Your WordPress Site Does not get Hacked Again.

Update to newest version of WordPress. Always.
Change passwords frequently.
Use htaccess file to secure your site. Ther are sveral sites that tell you how to do this, like this one

Link to Webmaster Tools Home Page

Google Analytics Plugin

Back Up WordPress database Plugin
Related Posts Plugin

Google Sitemap plugin

Help- Lost Toolbar and Palette in Adobe Illustrator !

How to Display Toolbar, Tools and Palette in Adobe Illustrator…

So this keeps happening and maddening. I am by no means any kind of an expert with AI but I do dabble. MANY times I have lost the toolbar and palette when working in Adobe Illustrator.. and everytime I have to search internet for a fix.
Here is the easy way- You have most likely hit the TAB key and lost it.
You can retrieve and get back toolbar and palette in Ai by either re- hitting the TAB key. OR go to WORKSPACE menu and click Basic or whatever workspace you use.
You wil instantly get your AI toolbar and palette back. Hope this helps!