How to Create a Custom WordPress Page Template From an HTML Table
A great advantage of WordPress is the range of customizations that can be made to it. Custom page templates can be uploaded to your WordPress folder, which can be selected individually from each page's editing screen. This allows different parts of your site to have different appearances. If you have an HTML template based on tables, it can easily be converted into a WordPress page template, and you will be able to keep the table structure intact.
Instructions
-
-
1
Log in to your WordPress administration control panel. Click on “Appearance,” then click “Editor.” From the list of files on the right of the screen, click “page.php.” When the file appears in the central editing area, select all the code and then paste it into a text editor like Notepad.
-
2
Start a new line at the top of the file, then copy and paste the following code:
<?php
/*
Template Name: PageTables
*/
?>Feel free to change “PageTables” to any name you think would be most descriptive.
-
-
3
Save the file to your computer's hard drive, giving it the same name as in Step 2, and the extension “.php”. For example, type “pagetables.php”.
-
4
Scroll down until you reach the “<body>” tag. Replace everything below this tag with your HTML code. If you have not already put the WordPress loop into your HTML code, paste this in to your code at the position you want the post content to go. The loop begins on the line that starts with “<?php if ( have_posts()” and ends on the “<?php endif; ?>” line. Save your changes when you're done.
-
5
Log in to the FTP account for your WordPress site. Navigate to your WordPress folder, then go to “wp-content,” then click “themes” and then open the folder for the theme you use on your site. Upload your page template file to this folder.
-
6
Return to your WordPress admin area. Go to “Pages” and click the title of one of the pages that you want to be displayed using your new template. Look to the right of the screen for the “Template” drop-down menu. Click it, then select the page template you just uploaded. Click “Update File” to save the changes. Repeat this process for all the pages you want to change.
-
1
References
- Photo Credit Comstock/Comstock/Getty Images