HTML Template into WordPress
It is well-known that all WordPress themes are built using PHP files. Actually, the whole WordPress engine – blogging software – is built on PHP. This post is not really about the difference between HTML and PHP files, and just for editing or manipulating your theme files (the templates as they are called in the WP terminology) you don’t need any specific PHP knowledge. I will talk about how to convert an ordinary HTML template into something usable in your WordPress theme.
The basic structure of any template file is just classic pure HTML, more exactly XHTML, which is a more advanced version of the HTML language. Then you have the occasional small PHP code snippets among the HTML code – they are called “template tags” in the WP documentation. Most users are happy with the available thousands of open source and free WordPress themes: they provide enough variety even without editing the template files.
However, there are cases when we have a nice HTML template looking different than our WordPress blog and we still would like to use it for special purposes in the blog. Such a case could be when a sales page template has a different layout and design but the WP blogger would like to use it as a Page template. (Remember, in the WordPress documentation Pages with capital P denote quasi-static entries which are not part of the chronological order of the posts.)
Quite often the novice user will try to copy and paste the HTML code of the new template into the content area of a Page – but that will never work correctly. There are easier ways to achieve the goal. The main mistake with the copy/paste approach is that the user is trying to force the blogging tool – in this case WordPress – to do something that is not inherently coded in it as a feature. More often than not they don’t even realize why their attempt is wrong: they are going against the natural work flow in WordPress. Instead, I suggest studying how the WordPress theme’s template system works and use it in our own advantage!
Let’s take the simplest case ever to implement a HTML template into your WordPress theme. Here is the starting point: we have a blog with its own theme and we got a salespage template to use. But the salespage template is all HTML. How to use it in among all the PHP files in the theme folder?
Simple: save the file with .php extension – e.g. salespage.php. Next, open it in a simple text editor and add this at the very top, before anything else:
-
<?php
-
/*
-
Template Name: My Salespage
-
*/
-
?>
Now upload it to your theme folder and create a new Page using this template. You just finished the “big” task converting an HTML template into a WordPress Page template.
For more complex cases you can download my free guide WordPress Page Templates Made Easy. Don’t forget to subscribe to the mailing list to get instant access to my other 7 Best Tutorials!
3 Responses to “HTML Template into WordPress”
Leave a Reply






Shelley Cox on March 8th, 2010
Wow, thanks for that easy tutorial, I’m inspired to try this out and make it happen. Really appreciate your wisdom and knowledge.
Thanks
Shelley
Thom on March 8th, 2010
Found this to be fairly easy to do with a little bit of tweaking plus I get the benefit better indexing and auto ping action with WP.
Thanks
Istvan Horvath on March 8th, 2010
I am glad you guys liked it.
Thanks for the feedback.