Wordpress Default Theme

The idea resurfaces for a change in default theme, poor (old) Kubrick is seen as tired, also the issue of themes with added function (known by some as functionality).

read more »

Wordpress Page Menu code

As requested, the code for page menu tabs - leaving open the possibility of using the ’sliding doors’ technique - put it in a theme’s functions.php, and the usage, if not too obvious, would be something like…

<ul id=”tabmenu”>

<?php echo buildMenu(); ?>

</ul>

read more »

The French Revolution - making life easy for programmers

frenchrevolution.jpgHappy 30th Messidor, citoyennes et citoyens!!

(Tomorrow’s the 1st Thermidor CCXV)

If I ever get the time, I’ll launch a (doomed) campaign to adopt the Revolutionary Calendar into our daily lives.

360 days, divided into 12 months x 30 days - plus 5/6 festival days at the end of the years - “sans-culottides” for the benefit of us sans-culottes, proles and plebians. (Plus 3 x 10 day weeks to a month and decimal time!)

The - maybe - clever thing is that for work/business/commercial purposes the holidays would not exist, and would not need to be included into the programming of commercial transactions.

Buy 6 months of web hosting on the 16th Vendémiaire - it ends on the 16th Germinal, no arithmetic necessary. Ok, people would start to get clever about start dates but we’d all be on holiday and not looking at web sites during their extra free time, so that wouldn’t be a big deal.

Why not? - usually to their own benefit, ad people run their Net30 day terms & conditions, and few rise up in Bastille-storming revolt about this.

It would discomfit large commercial interests - a good thing.

Vast amounts of calendar-handling code could be junked, and never need to be painstakingly written and debugged again - a very good thing.

So….. it’s not going to happen - I may have to go for plan B - which is Christmas once every 4 years, much better…

WordPress Plugin Ethics

I was looking at some of the recently released plugins, particularly this stock data one and also something for media content - which adds a noembed section to any embedded content that does not already have one - very handy for people reading a site in an RSS reader.

It was the <noembed> tag which was the clue. read more »

WordPress Widget API

For theme-building purposes, I was trying, idly, to produce a string of the headings of all active widgets - and it’s not very easy at all. Perhaps, some very involved SELECT would have done the job, but it would be a horrible hack.

Must confess it, I’m not a great fan of how the widget data are stored - each box existing as a separate option and no simple relationship anywhere to tie them together.

read more »

Com64 WordPress Theme

c64.jpgThis is just a bit of fun - a theme based, roughly, on the Commodore 64 monitor display, with some javascript to type out the blog title - it’s a retro symphony in garish blue.

It’s a fixed-width, 2 column with right sidebar theme, enabled for widgets and compatible with WP 2 upwards. The theme has been tested on Firefox 1.5, 2.0, Internet Explorer 6 and Opera 9.

Download: Com64 WordPress Theme - zip - tar

Release Notes:

The javascript is easy enough to switch off…
This theme is not sponsored.
Released under terms of GPL v2

Banners in some posts on the index page

You want to put an advert (or anything else) after some posts on the front page, but not others.

There are some fancy programming ways of doing this involving template tags, but this way will do just fine and couldn’t be simpler.

First, find the Loop in your index.php

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

… the post …

<?php endwhile; ?>

read more »

Getting a start as a freelancer

Freelanceswitch have a copious list of advice for freelancers, and it’s good - here’s a brief critique of their section on freelance programmers

* Pitch yourself as a developer who understands web designers, because most of them need a developer

Less true nowadays - the halfway-competent freelance web designer will be using CMS software out-of-the-box, you can end up dealing with the less competent end of the market. But never lose the opportunity for these alliances.

* Write a small web app like ta-da list or jobpile and get some recognition

Largely identical to the final point - see below…

* Answer tech questions on forums and use a signature that says you offer freelance coding services

Good advice - but relatively time-consuming and in marketing speak, the quality of leads is abysmally low.

* Enter a programming contest like RailsDay

Prizes, by some magic, come to proteges of the sponsors with monotonous regularity - is this harsh? Possibly… You have to go into this without firm expectations, although dividends can be high…

* Contribute to open source efforts and get known

Absolutely - whether your own app or a well-known ‘brand’, even if it’s just a plugin with a few lines of code, this is the way to get a foothold. It’s something tangible to show prospective clients, it’s absolute proof of your skills. It also gives you feedback for improvement, because you’re not the world’s best just yet.

WordPress and XAMPP

Xampp is the best of Open source - and a good way to have a development version of WordPress. When time permits, I’ll get together a guide to installation with particular regard to WordPress. There’s a good one for Xampp Lite on a memory stick here. And also one for WAMP…

For now, life goes much better if it is installed at the root ie C:\xampp\ rather than C:\Program Files\xampp\ (that’s an absolute for Vista, but strongly suggested for XP etc) And don’t dedicate anything as a service.

Redirect visitors to your new Wordpress blog

You moved your blog to a new domain name and want to redirect everything still going to the old location to the new one.

This applies only if you still have some control over the old server and can put a .htaccess file in, via the control panel or FTP.

.htaccess commands apply only to the directory in which the .htaccess file resides, and all the directories under it - so it’s by far the best that it goes in the same directory as your old blog left.

The .htaccess file

A plain text file where server directives are stored. The server reads it before doing anything else like outputting a page and acts on its commands.

No name, just a dot and an extension - some text editors struggle with this. If you are creating a .htaccess in desktop Windows, say, always use Notepad, or something simple. And set your file explorer to display hidden files, while you’re doing it.

The basic command is simple

Redirect /olddir http://www.newdomain.com/newdir/

But this will do a temporary redirect (status 302) which search engines do not like - it’s long been favored by spammers, so we need a 301 status code.

Redirect 301 /olddir http://www.newdomain.com/newdir/

(or

RedirectPermanent /olddir http://www.newdomain.com/newdir/

does the same thing).

Mapping the old domain to the new - mod_rewrite.

This requires the PHP mod_rewrite module to be installed and active on your server. It usually is - you can check the php_info in your control panel, or just try it and see if it works.

Again, in your .htaccess file

Options +FollowSymLinks
RewriteEngine ON
RewriteRule ^(.*)$ http://www.newdomain.com$1 [R=301,L]

You need the first two commands to get mod_rewrite going

The ^(.*)$ is an example of a regex, or regular expression. Complicated things, but this one essentially captures a path, any path, into a reference $ which is then used in the second part of the command as $1

[R=301,L] the redirect is to be a status 301 http request and the L is for last command - we’re finished…

Unless you want to redirect all requests, regardless of the page requested, to the index page of new domain, in which case:-

RewriteRule /.* http://www.newdomain.com/ [R=301,L]

That is it - upload the .htaccess to the old server and see if it does what it’s supposed to. (It probably won’t, these things rarely work first time - but stick at it…).

Related resources:

Megaboring, but total explanation of mod_rewrite

(If you’re looking at this tutorial in 800 x 600px the commands have been kept on the same line with non-breaking spaces where necessary - you might need to go up one resolution)