Updated 404 template for Anaximander

One of the templates that is often overlooked when creating a WordPress theme is the 404 template. The 404 template creates the 404 page that appears when a viewer follows a broken link or enters a garbage link in the address field in their browser. You can see an example by following this link which obviously goes nowhere:

In the rush to release Anaximander and my most recent course WordPress: Building Responsive Themes the 404 template in the starter theme got a bit mangled. I was made aware of this by one of my viewers and we are updating the lesson files as we speak. If you’ve already started on the course or are using Anaximander for your site, I’m providing the fixed file here for you to download and install directly.

Click here to download the zip archive with the 404.php file.

To install the new 404 template unzip the archive and place the new 404.php file inside your Anaximander-Static folder replacing the old one.

The new 404 template is similar to the search template: It provides a simple message saying something went wrong and then offers up the 12 most recent posts as an option to the visitor.

Tutorials WordPress

Custom Page Templates in TwentyTen

With the release of WordPress 3.1 came a new version of the stock TwentyTen theme with some subtle changes, most importantly the move of all the loop elements in the templates (the code that runs through the database and gathers info like title, date, author, categories, content, images etc) into their own files. In the first release of TwentyTen this was restricted to just the single post view (loop in loop-single.php) but now it also extends to among other files the page tempalte (loop-page.php).

The problem arises when you want to create custom page templates. Previously all you needed to do was copy the page.php file and make the changes you wanted in the loop. But with the new system copying the page.php file alone won’t let you make any changes to the loop, just the overall structure (header, sidebar, footer etc). To make changes to the loop you have to either copy the loop code out of loop-page.php and into your custom page template or use a conditional statement along with the is_page_template() function in the loop-page.php file to detect that a custom page template is being used and then make the changes. The video above demonstrates both approaches.