Customizing a Page on WordPress

It’s always recommended to be consistent with your site’s look and feel. However, there may be a time when a page calls for a unique look and feel. Be it you homepage, or a special landing page, or a complex form. For those cases there should be a way to customize a unique page without affecting other pages’ appearance, and indeed, there is. In fact, there are at least two.

WordPress has a theme hierarchy. Which means that whenever a page is loaded, the system detects its type, and calls for a ceratin template file from your theme directory. If that file is missing, WordPress will fall back to the next in line.

For page display, WordPress will look for a theme file called page.php, however it will look first for a file called page-NN.php, where NN be the pages id.

So if your special page’s ID is 44, create a file in your theme’s directory, called page-44.php, and use it to customize your page layout. Even better would be to save the page.php file as page-44.php. That way you already have a base that you can start work on.

You can also create a file named page-my-new-landing-page.php, where “my-new-landing-page” be your special page’s slug. Yes, before WordPress looks for a page-NN.php, it looks for a page-SLUG.php!

Read more about WordPress theme hierarchy here.

Using a theme file

Sometimes you need to customize not just one page, but a couple of pages. For example, a series of landing pages. In this case, you will be better off setting a special template file to rule them all.

First thing: Create a file in your theme directory, and give it a name. For instance: “landing_page.php”.

Open the file with your favorite text editor and add these lines:

/**
* Template Name: Landing Page Them
* A custom page template for landing pages
*/

The “Template Name” bit is the identifier of this theme.

Once this is done, go to the back office and create or edit a page. When the page is open for editing you will notice on the right hand side the “template” drop-down menu. From this menu you can now choose your new template for this page, and others.