Archive for the ‘WordPress’ Category

Claiming your WordPress blog in Bloglines

Friday, May 16th, 2008

After having claimed my blog in Technorati (see previous post) I thought I’d try to do the same in Bloglines. They have a completely different way of verifying ownership.

They require you to add a hidden tag to your blog template and in one of your blog posts. They tell you what to add but they don’t explain how to do it. A search on Google reveals that a lot of people with self-hosted WordPress blogs seem to be finding it very hard to claim their blogs.

Due to the lack of instructions I made a guess at what to do and managed to get my blog claimed first time. Maybe I’m just lucky! :) This is what I did. Note that these instruction are for self-hosted WordPress blogs and may not apply for other blog platforms or for blogs hosted on the WordPress site.

In the Publisher Tools section of my account on Bloglines I went through the basic steps of adding my blog URL until I got to the page giving the claim tags. As you can see the page gives no clues as to how you are supposed to apply the tags to your blog.

bloglines blog claim

I use the Default theme on my site so I edited the header.php which lives here:
wp-content/themes/default/header.php

If you use a different theme you should modify the equivalent page in your theme.

I added the tag in the <head></head> section of the site as this tag isn’t designed to be viewed. You could probably add it anywhere in the <head></head> but here is where I added my tag.

<link rel="alternate" type="application/rss+xml"
 title="<?php bloginfo('name'); ?> RSS Feed"
 href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback"
 href="<?php bloginfo('pingback_url'); ?>" />
<!-- ukey="3064F3CF" -->
<style type="text/css" media="screen">

Then I went into the Manage section of my WordPress control panel and edited the latest post using the non-WYSIWYG plain text editor. I inserted the blog tag at the very top of this post. This tag is non-viewable so you don’t need to worry about anyone seeing it.

bloglines add tag to new post

After doing this I went back to Bloglines and pressed the button to verify my claim. And it worked!

bloglines verification ok

Adding spacing round an iframe in WordPress

Wednesday, March 5th, 2008

It was whilst writing a review of the book ‘boo hoo’ that I spotted a problem with embedding iframes in WordPress postings. As I was reviewing a book I wanted to add an Amazon Product link. These product links are in the form of iframes. An example of the HTML is below. I added the align="right" myself as I wanted the text to flow around the iframe.

<iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=advancedhtml-
21&o=2&p=8&l=as1&asins=0099418371&fc1=000000&IS2=1
&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr"
style="width:120px;height:240px;" scrolling="no"
marginwidth="0" marginheight="0"
frameborder="0" align="right"></iframe>

You can see from the image that in WordPress (in the default theme anyway) there is no spacing between the left edge of the image and the text. This looks wrong so I wanted to find a solution to this.

Amazon iframe problem

It seems that there are no padding tags that you can add to an iframe unless you use style sheets. I wanted a simple solution that I could just embed in the HTML. The solution that I chose was to put the iframe in a table and set the cellspacing attribute of the table to the required amount padding. Instead of using align in the iframe I am now using it in the table. The HTML and result of this change are shown below.

<table border="0" cellspacing="10" align="right"><tr><td>
<iframe src="http://rcm-uk.amazon.co.uk/e/cm?t=rmlcouk-
21&o=2&p=8&l=as1&asins=0099418371&fc1=000000&IS2=1
&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr"
style="width:120px;height:240px;" scrolling="no"
marginwidth="0" marginheight="0"
frameborder="0"></iframe>
</td></tr></table>

Amazon iframe fix

You’ll probably agree that the Amazon product links looks much better with the extra spacing.

Roll on one click updating of WordPress plugins

Wednesday, February 13th, 2008

Today I saw the future of WordPress plugin upgrades.

Anyone who has a WordPress blog with a number of plugins installed will know how much of a chore it can be to keep those plugins up to date. The official way of upgrading any plugin involves:

  1. Spotting the plugin has a new version available from the WordPress plugin page.
  2. Downloading the new version of the plugin to your computer.
  3. Unzipping it.
  4. Deactivating the current version of the plugin from the WordPress plugin page.
  5. Uploading the new plugin via FTP.
  6. Activating the new version of the plugin.

This is boring, and wastes my time, but unfortunately is often essential. Especially if the update is to solve a security vulnerability. I have several blogs, including this website building related one and my London Underground walking blog. Each of these blogs has six active plugins so each time one of these plugins is updated I have to update the plugin in two separate places.

Today I went onto the option page of the All in One SEO Pack plugin and spotted an option which I hadn’t seen before – ‘One Click Upgrade’.

One Click Upgrade option on WordPress All in One SEO Pack plugin

As it happens this plugin was out of date so I clicked it and after a second or two saw this message.

One Click Upgrade option on WordPress All in One SEO Pack plugin

How cool is that? Very. It has changed upgrading this plugin from a chore to something that is almost fun. Behind the scenes when you click the button it fetches the latest version of the plugin and extracts it to the correct location.

This is the kind of feature that we are used to seeing on PC software but it is the first time I’ve seen it on a WordPress plugin.

On further investigation I spotted an interesting project which attempts to generalise the one click update of WordPress plugins. It is called the One click plugin updater. This tries to add this facility to existing plugins. From the comments on the plugin page it looks like it doesn’t work for all everyone but it is certainly a very good idea.

This facility is definitely something that WordPress should think about integrating into its core code base and encouraging all plugin creators to adopt.

Adding source code into WordPress blog posting

Sunday, October 21st, 2007

As demonstrated by another post of mine I finally figured out how to easily add source code into a WordPress blog posting. Searching on Google for this issue reveals large numbers of people facing the same problem. It makes you think that including source code in a WordPress 2.2.1 blog posting is the most difficult problem known to man.

Many of the problems seem to be caused by the visual editor in WordPress. It reformats code in ways that you are unlikely to want (such as trimming any whitespace), leaving your carefully constructed source code looking like a real mess.

The way to turn it off is to go to ‘Login -> Users -> Edit’ and then untick the ‘Use the visual editor when writing’. There seems to be no way to edit and then re-edit in-line source code when the visual editor is turned on, because when you re-edit your posting the visual editor reformats your code automatically – even if you don’t make any changes and switch straight to the code editor.

This problem is in part because if you have the visual editor enabled it becomes the default editor and re-formats any code that it loads. WordPress could easily fix this be allowing you to make the code editor the default editor so the visual editor only gets its hands on your posting if you give it permission. There is a discussion on the worpress.org site about this here.

If you still want to use the visual editor then the workaround that I’ve seen mentioned is to create a second user account with the visual editor turned on. You then need to use the correct account depending on whether you will post source code or not and remember never to load your source code posts with the visual editor.

The next problem that I came across was that adding code within <pre></pre> tags causes the lines to be double spaced when using the default WordPress theme. I solved this by installing the CodeMarkup plugin which allows code samples to be displayed in a way which looks sensible to me. It automatically escapes all your code so that you can paste it directly in between <pre><code></code></pre> tags without having to use a tool tool to escape the special characters.

AddThis widget

Sunday, September 9th, 2007

I’ve been looking for a simple way to add those ‘Add to…’ buttons at the bottom of each of my blog entries. I’ve looked at a number of different methods of adding the buttons but the best one I’ve seen is the one from http://www.addthis.com/. It can be easily integrated into the major blogging tools.

If you use blogger you can easily update your blog template to include it. If you use WordPress then there is a simple plugin that you can use. There are a number of different versions of the AddThis widget but I’ve gone for the WordPress plugin of the drop-down version. Installing is easy. Just put the plugin in your WordPress plugins directory and activate it. By including your AddThis username in the php file you can get stats to tell you how often people have clicked on the links.

Update 2010: Due to layout and functional problems with AddThis I’ve switched the site over to Bookmarkify.

Setting up a WordPress blog on 1and1

Sunday, August 5th, 2007

Having decided to start a blog I had two main options for how to do it. Either create a blog using one of the many blog hosting sites, or host it myself on my own 1 and 1 web space. Hosting it myself is clearly the most flexible option, and for a techy like me the most fun. I did a bit of research into different blogging software and WordPress to me looks good enough for me.

I was initially a bit worried about the amount of MySQL database space that is needed for blog software. 1&1 databases are limited to 100mb and I wasn’t sure how much space WordPress would need. At work I manage a 5db database with the largest table having over 100 million rows so I’m well aware that databases can get big! Fortunately it seems that WordPress uses space very efficiently and even very large blogs only need a few megabytes.

WordPress comes with a load of documentation, but I did most of my setup by following the instructions on http://antbag.com/how-to-install-wordpress-with-1-and-1-hosting/ which has some good instructions specifically tailored for people on 1&1.

I’ve left the configuration pretty much at the default settings for now but I did add http://blogsearch.google.com/ping/RPC2 to the ‘Options->Writing->Update Services’ box so that Google Blog Search is notified for each update.