If you’re just starting to put together a WordPress blog, one snippet of code in your header file will make things so much easier:
The Code
<base href="http://your_blog_address_url">
(replacing your_blog_address_url with the actual url - mine would be themindschewtoy.com)
So, why will this make things easier?
Example 1
Well, let’s say you want to add a BannerBot to your post like I did. Since the src.txt file does not include your website (i.e. themindschewtoy.com) when pointing to the location of the files it needs to work, you will not see the BannerBot on anything except your home page. If you’re on the category page, the tag page, or the post page itself, you will see only blank space.
Adding your base href to your header, however, nails down the location of the file, no matter what page in your site you’re viewing it from.
Example 2
Or, let’s say, after working on your website for months, you decide to change your web address. Maybe you’re doing it because you think it will be easier for people to remember, or maybe it’s because it defines your site better. Whatever the case may be, after going through the process of moving the WordPress database to your new domain, do you really want to have to go through each post and change each and every link to your site? I doubt it.
But, if you added that one line of code to your header file early on (like I did), my links are set up differently. Instead of pointing to the full web address for, say, my afore-mentioned BannerBot Post:
<a href="http://themindschewtoy.com/2006/10/30/bannerbot/"></a>
I do this:
<a href="2006/10/30/bannerbot/"></a>
(Important! Do not put a / at the beginning of your link!)
That way, all I would have to change would be that one base href code line in my header template, and all of my links would point to the right location.
Nice, huh?



