All posts by John Blackbourn

WordPress Plugin: Head Meta – Add Anything to the <head> of a Post

Latest version: 0.2 – Released 21 March 2007

Description

Ever wanted to add things such as JavaScript or meta data to the <head> of a page when you’re writing a post? It usually means editing the header.php file in your blog’s template, which is time-consuming and especially complex if you only want to add it to certain pages or posts. This is where the Head Meta plugin comes in. It allows you to simply type your meta data or your JavaScript into a custom field and have it show up inside the <head> on your post or your page.

Example

On the page for my Firefox Twitter Updater I needed to insert a <link> into the head, but have it only inserted when viewing that blog entry on its own. I typed the whole <link> element into a custom field named “head-meta” and while the plugin is active the <link> shows up in the document’s <head> without having to alter anything in the template. See the screen shot below:

Example of usage of the Head Meta plugin for WordPress

Installation

This plugin is only recommended for people who are comfortable writing HTML by hand and who know what meta data is. If you don’t know why you’d need this plugin, then you don’t need it. For those who do, download the plugin using the link at the bottom of this page, unzip it and drop the head-meta folder straight into your wp-content/plugins directory and activate the plugin from WordPress’ Plugin panel.

Your WordPress theme must have the wp_head() function inside the head for this plugin to work. The default themes bundled with WordPress have this, and many themes you can download do too, but if this plugin doesn’t work for you please ensure this function is in the head of your theme.

Usage

Using this plugin is easy. Simply type the meta data which is to go into the <head> of your post or page into a new custom field and name the key “head-meta” (without the quotes). Take another look at the screen shot above if you’re not entirely sure.

Download

ZIP file from lud.icro.us

More Details

The meta data will only show up in the <head> of your document when viewing the post or page on its own (ie. at the post’s permalink). It will not show up, for example, on the front page of your blog even when the post concerned is visible on the front page. This is because my particular needs were that I only wanted the meta data to show up when viewing the post on its own.

Any comments, questions, queries, suggestions, complaints, etc, please leave a comment below!

Firefox Search Plugin: Post Updates to Twitter right from your Firefox Search Bar!

April 18th 2008:
This no longer works. Try an alternative instead.

Description

“Post to Twitter” is a search plugin for Mozilla Firefox which allows you to quickly post statuses (or “tweets”) to your Twitter account from the Firefox search bar. It is not an extension — it is a Firefox Search Engine. This means you can activate and install it in about five seconds, and start using it straight away without having to restart Firefox.

Evan Williams, the co-founder of the company behind Twitter, described it as

wicked cool

Download

Take a look at the button to the left of your Firefox Search Bar now. You’ll see that the button has a faint glow around it (Mac users, the arrow will be glowing). This indicates that the website you are viewing has a search engine available which you can install with just two clicks – in this case the search engine is not a search engine at all, but a Twitter updater.

Click the drop down menu and click Add “Post to Twitter”. The search engine will be downloaded and installed and you can start using it straight away.

How to use it

To post a status to your Twitter account, simply select “Post to Twitter” from the search engine drop down menu (if it isn’t selected already), type your status, and hit enter. If you are already logged into your account on twitter.com your status will be posted straight away. If you’re not logged in, you’ll be prompted to do so and then your status will be posted right after you’ve logged in.

Very Important

Once you’ve posted your update, don’t forget to switch back to your default search engine straight away so you don’t accidentally post to Twitter the next time you go to search for something. Simply click the drop down box and click on Google (or whatever your favourite search engine is) then carry on about your normal business.

Requirements

The only requirements for this plugin to work are that you have Firefox 2 (or later) and a twitter.com account.

Geek Stuff

The “Post to Twitter” search engine plugin is written in OpenSearch formatted XML. You can find out more about writing your own OpenSearch search engine plugins at the Mozilla Developer Center: Creating OpenSearch plugins for Firefox. If you’re familiar with the OpenSearch format then you might be thinking to yourself, hang on, this plugin should work in Internet Explorer 7 too, but you’d be wrong. The plugin uses the POST method which is not supported by IE7. The POST method is required to post your status to twitter.com, and using GET will not work. If IE7 one day does support POST then I see no reason for the plugin not to work in IE7 too.

Questionably Useful Thing: Really Big Source Text

Update (11th August 2007): We now have numbers!

Description

View-source. You’ve gotta love it. But it’s a bit boring sometimes – line after line of hypertext, with the only highlight being nice indentation if you’re lucky. I thought I’d liven things up a bit by putting some nice messages into the source of my web pages. For example:

 _____   ______   _____   _       _____   ______   _____   _____   _____   _____
|  _  | |  __  | |  ___| | |     |  ___| |  __  | |  _  | |_   _| |  ___| |  _  |
| |_| | | |  | | | |__   | |     | |     | |  | | | |_| |   | |   | |__   | |_| |
|    _| | |  | | |  __|  | |     | |     | |  | | |  ___|   | |   |  __|  |    _|
| |\ \  | |__| | | |     | |___  | |___  | |__| | | |       | |   | |___  | |\ \
|_| \_\ |______| |_|     |_____| |_____| |______| |_|       |_|   |_____| |_| \_\

That would surely cheer up any source code haxor. So I decided to spread the love and create a really big source code text generator. Give it a go below.

Instructions

You can use the generator below to create really big source code text for your own website. Type the text you want to show up really big in your source code into the box below. It will show up in the larger text area underneath. Numbers and several punctuation characters work too, you’ll have to try them.

What Now?

Copy and paste the text out of the big text area and whack it into your source! You can paste it into a JavaScript tag as long as you keep the /* and */ in place, but don’t forget to put it between <!-- and --> if you’re just going to whack it into your source. View-source this page if you want to see a huge source text message out in the wild.