Monthly Archives: October 2009

How to modify an existing theme

All WordPress Themes are released under the GNU, which means you’re free to amend and modify them as you please. That’s good news if you come across a layout that you like to 90%, and you’re up for the challenge to get down and dirty with some code.

The WordPress Codex is very good at explaining in detail how to modify a theme, but it’s fairly complex if you’re starting out. Let me give you a quick overview on what WordPress does to display your page in a browser:

Display your favourite WP site in your favourite browser. Then right click and display the source code of that site. What you see now is what your browser turns into something nice to look at: your page.

Even though all this code gets displayed at once, it is sent to the browser “on the fly” by WordPress if a user requests the page. This process happens in snippets of code, which is made up for several files that make up “the theme”.

If you have a look at a theme directory (usually wp-content/themes/youthemehere/), you’ll see several files. One of them (index.php) is the first file that’ is used to display a theme. This file calls other files, such as header.php, sidebar.php, footer.php and many others.

Part of the challenge is to find where the piece of code is that you’d like to modify. Your navigation menu at the top may be called in the header.php file,  or it may be called from index.php. You have to play detective to figure it out.

You can do this from within WordPress by navigating to Appearance – Editor. Select the theme you want to modify at the top right your current theme is already selected. On the right side you see all the files your theme is made of. Have a look at Anatomy of a Theme to find out more about those.

If you want to make a change, your files need to be writable on the server (do this with an FTP client such as FileZilla, and set your theme files’ permissions to CHMOD 777).

Before you start to modify any code, I highly reccomend to copy your entire theme folder to a safe place. You’d be surprised what a missing </div> tag can do to your design…

Have fun!

How to replace a Header Image

Not every theme provides a convenient “upload header” option. That’s luxory really. But there’s a fairly easy way to replace every header image in every theme with one of your own pieces of art.

Here’s what you do:

Right-click on the image you want to replace and select Properties. This will give you an idea how big the image is, and what its filename is. Note both down and open Photoshop or similar).

Select an image you’d rather like, and crop it to the exact same dimensions of the image you’d like to replace. Depending on the format of the original image, save yours as a GIF, PNG or JPG with medium compression (say 70), ideally using the Save for Web option.

Next open your favourite FTP client such as Filezilla and login to your site via FTP (not via WordPress). Find your theme’s directory (usually in wp-content/themes/themename) and locate that image file. Sometimes it’s right there in front of you, sometimes it’s in a subfolder. Have a quick poke until you find it.

Next, copy your own image into that directory. Rename the original image to something different, and give your own image the name that the original image used to have. Note that it’s cAsE sEnsitIve!

Refresh your site, and – in an ideal world – your own image will show up.


  • If you see the old image, clear your browser’s cache and try again.
  • If you still see the old image, you’re replaced the wrong file…
  • If nothing shows up, your image is spelt differently than the original image.

When in doubt, check your sites source code and see which image filename is called. Rename your image accordingly. Keep in mind that Acuity Training is available today for almost any specific thing, you can learn anything you just need to ask and listen then do.
Good luck!

How to increase your PHP Memory Limit

With certain plugins, you may encounter error messages that tell you your PHP memory limit is not high enough. It usually means: you need more!

Like your computer being really slow when you run out of memory, PHP does the same thing, sometimes refusing to work flat out. That’s not so good.

There are several ways of changeing this, and I’ll go through a couple of options here:

Editing your .htaccess File

This is probably the safest and easiest way to adjust your PHP Memory Limit. If you don’t know what a .htaccess file is, have a look at this article.

In a plain text editor, open the file and add the following value:

php_value memory_limit 32M

The default value is set by your server (usually 16MB), and line of code will change it for your current directory. Change it whatever you please (I’d recommend 64 or 128M), but please note that some hosting companies may not allow this.

If you don’t have a .htaccess file, just save a plain text document with the above line, upload it to your root directory, and rename it .htaccess – refresh your browser, and you should be good. If in doubt, clear your browser’s cache – it works wonders at times.

Editing you php.ini File

This of course is only possible if you have access to this file. That’s only the case if you have direct access to your server. Ignore this method if you’re on a shared hosting package.

Open the file and have a look for the following line of code. It’s usually located in the section “Resource Limits”:

memory_limit = 32M  ; Maximum amount of memory a script may consume (32MB)

Again change the value to something you’d rather see here. Save the file, reboot your server, and you should be sorted.

How to check if my changes have taken place

Once simple and straightforward way is to check if your plugin is working now, preferrably without that error message.

If you’d like to be more certain, have a look at this very simple WordPress Plugin by Next Gen Gallery creator Alex Rabe: it’s called WP Memory Usage. It’s a friendly little thing that will show you not only your PHP memory limit, but also your current PHP memory usage (as the name suggests).

As always, good luck 😉

What is a “Point Release”?

With the arrival of WordPress 2.8.5, I mentioned to my good friend Dave Lee that this is a “point release”. He didn’t quite know what that meant, so I thought maybe I’ll share the knowledge.

Many if not all software projects have regular improvements that the coders come up with. Usually for reasons for security or some operational improvements. These improvements are indicated by a higher version number. As an example, Microsoft Office 2007 is a higher version number that Office 2003, because it’s a later release with major operational changes. Other examples:

  • WordPress 2.7 compared to WordPress 2.8
  • Filezilla 3.1 compared to Filezilla 3.2
  • Firefox 3 to Firefox 3.5
  • Internet Explorer 7 to Internet Explorer 8

After an initial release, minor bug fixes and non-major additions may be released, which improve the product, but don’t make fundamental changes. This is called a “point release”.

It usually means the overall look and feel of the product stays the same, and no major features are added (or removed for that matter). With point releases, you see version updates such as

  • WordPress 2.8.5 over 2.8.4
  • Filezilla over
  • Firefox 3.5.2 over 3.5.1
  • Internet Explorer 8.0.6001.18702 over an smaller number after the initial point

Usually, the higher the number after the point, the later your version is – and (apparently) the better your software should be working.

Hope this helps!

Where is php.ini on a Linux Server?

By default, it’s located in /etc/php.ini

In this file, you can set your upload limits, memory limits, safe mode and many other settings that you may wish to change.

Before saving permanent changes to this file please consider the following:

  • CREATE A BACKUP before saving
  • all changes will be live AFTER REBOOTING your machine
  • all changes are applied SERVER WIDE to all accounts and sites on your server

If you would like to make changes to a specific directory, consider making changes in your .htaccess files.

How to avoid Server Crashes with WordPress

WordPress has many pros for content creators like ourselves, but every once in a while there’s a big con that can get in the way of WordPress Fun. One of them is really annoying: when your website becomes regularly unavailable due to a server crash!

Even though a reboot brings things back to normal for a while, you can’t afford your site(s) to have regular downtime.

Worry not, for help is at hand – by installing a simple plugin called WP Super Cache.

The great thing about WordPress is that your site is built and output to the browser “from scratch” every time you get a visitor. That’s the nature of a dynamic website.

Of course the downside is that while the server has to process all these PHP requests, it uses up a lot of valuable resources. When you only get 10-20 visitors a day you won’t notice the difference, but if you get 100+ and regular “visitor attacks” or traffic spikes, it can cause your server to waive the white flag of defeat. You’re affected on dedicated, virtual and shared hosting packages alike.

You can help your server by using a caching plugin, such as WP Super Cache or WP Cache.


File Servers are really good at returning a file when requested by your browser. They can do all kinds of other things too, but serving files is their strong point.

WordPress and other PHP based applications often make the server do things that are really difficult for him. Even though you don’t hear your server complain, he might tell you he’s confused – not in so many words, but by simply not responding anymore.

If you’re running several projects out of one dedicated or virtual server, a crash will cause ALL your projects to go down. Shared hosters will most likely be told off by their provider and risk to lose all data in a potential reset or rebuild.

By creating static websites for everyday visitors, you’re helping your server do what he does best. Meanwhile, the cache plugin rebuilds your site in set intervals (every once per hour by default, but you can adjust it any way you see fit).


If you think you’re affected by server crashes, or you want to give your server a break, or you want your site to load a lot quicker, go download the plugin and install it.

Or, if you’d like to read a bit more about the plugin, head over to developer Donncha O Caoimh’s site.


I know what you mean… it’s not for the beginner or faint hearted alike to install this plugin.

If you want this plugin on your site and can’t hack it yourself, contact me and I’ll help you for a fee.