How To Convert HTML To WordPress (All Methods Covered)
How To Convert HTML To WordPress (All Methods Covered)
TOPICS
WORDPRESS
June 14, 2019 9min Read Luqmanul M.
While it’s still okay to have an HTML-based website as HTML5 is quite powerful,
especially for a showcase site. But for everything else, WordPress provides
more comfortable solutions. WordPress offers plenty of themes, plugins, and
widgets to improve the website and add useful features.
It’s also easy to manage. You can add and remove content without coding.
With an HTML site, it’s a different story. Unless you know how to code,
updating content with HTML can be difficult.
In this article, you will learn how to convert static HTML to WordPress, and
different methods to do it. Let’s get started.
Creating a WordPress Theme from a static HTML site. If you prefer your
old HTML website’s design intact, this option is for you. It’s also the most
challenging route and requires coding. But, don’t get intimidated. All you
need to do is copy/paste the old HTML code into several PHP files.
Losing the design and keeping the content only. If you’re okay with leaving
behind your old website design and find a WordPress theme for a fresh
start, this option is for you. You only need to transfer the content to its
new home.
Using a child theme adapted from an existing theme. This is probably the
easiest route if you want to retain the old website’s design. With this
method, you’ll use a pre-existing WordPress theme and build upon it. As a
bonus, you can use WordPress’ powerful features right away.
If your goal is to create a WordPress website that resembles your old HTML site
from scratch, you can start here. In this tutorial, we use a static HTML template
by Rachel McCollin.
Create a new theme folder on your desktop and name it. We’re naming our
folder as my-theme. After that, open your code editor and create the following
files:
style.css
index.php
header.php
sidebar.php
footer.php
/*
Theme Name: My Theme
Author: LakiGarang
Author URI: https://hostinger.com/tutorials/author/luqman
Description: A development theme, from static HTML to WordPress
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
Right after the header, copy and paste your old CSS code into the file. Save
and close it.
WordPress uses PHP to pull information from its database. So, you need to split
up your old website’s HTML into different pieces to make sure it can put them
together correctly.
If this seems complicated, don’t worry too much, the process is quite
straightforward. First, let’s see how our static website and its code looks.
<!DOCTYPE html>
<!--[if lt IE 7]><html lang="en-US" class="ie6"><![endif]-->
<!--[if IE 7]><html lang="en-US" class="ie7"><![endif]-->
<!--[if IE 8]><html lang="en-US" class="ie8"><![endif]-->
<!--[if IE 9]><html lang="en-US" class="ie9"><![endif]-->
<!--[if gt IE 9]><html lang="en-US"><![endif]-->
<!--[if !IE]><html lang="en-US"><![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>WordPress Writer and Instructor | RACHEL McCOLLIN</title>
TUTORIALS
<link rel="stylesheet" type="text/css" media="all" href="style.css"
/>
<link href="https://fonts.googleapis.com/css?
family=Assistant|Oswald" rel="stylesheet">
</head>
<body>
<div class="header-bg">
<header role="banner">
</hgroup>
</div><!-- header-bg-->
<div class="main-nav">
<ul class="menu">
<li class="menu-item"><a
href="https://rachelmccollin.com/">Home</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/about-me/">About Me</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/books/">Books</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/bookclub/">Book Club</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/blog/">Blog</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/contact/">Contact</a></li>
</ul>
</div>
<div class="main">
<article class="post">
<h2 class="entry-title">Welcome to This Website</h2>
TUTORIALS
<section class="entry-content">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>And so on...</li>
</ul>
<aside class="widget-area">
<div class="widget-container">
</div>
</aside>
</aside>
<footer>
<div class="fatfooter">
</div>
</footer>
</body>
</html>
Now, open your old static website index.html file, we’re going to split that into
the newly created WordPress files. (The examples below are our markup).
header.php
TUTORIALS
Everything from the beginning of your old HTML code up to the main content
area goes into this file. The main content area usually expressed with <main>
or <div class=”main”>.
Additionally, right before the </head> element, copy and paste this code <?
php wp_head();?>. This ensures WordPress plugins work properly. When you
finish, save the file.
<!DOCTYPE html>
<!--[if lt IE 7]><html lang="en-US" class="ie6"><![endif]-->
<!--[if IE 7]><html lang="en-US" class="ie7"><![endif]-->
<!--[if IE 8]><html lang="en-US" class="ie8"><![endif]-->
<!--[if IE 9]><html lang="en-US" class="ie9"><![endif]-->
<!--[if gt IE 9]><html lang="en-US"><![endif]-->
<!--[if !IE]><html lang="en-US"><![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>WordPress Writer and Instructor | RACHEL McCOLLIN</title>
<body>
<div class="header-bg">
<header role="banner">
</hgroup>
</div><!-- header-bg-->
<div class="main-nav">
<ul class="menu">
<li class="menu-item"><a
href="https://rachelmccollin.com/">Home</a></li>
TUTORIALS
<li class="menu-item"><a
href="https://rachelmccollin.com/about-me/">About Me</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/books/">Books</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/bookclub/">Book Club</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/blog/">Blog</a></li>
<li class="menu-item"><a
href="https://rachelmccollin.com/contact/">Contact</a></li>
</ul>
</div>
sidebar.php
Everything belonging to the section <aside … </aside> in your old HTML code,
goes into this file. When you finish, save the file.
<aside class="widget-area">
<div class="widget-container">
</div>
</aside>
</aside>
footer.php
Now, everything up to the end of the file should be the footer information,
which goes into this file.
Just before the closing bracket </body>, add this code <?php wp_footer();?>
for the same reason as in header.php. When you finish, save it.
<footer>
<div class="fatfooter">
</div>
</footer>
<?php wp_footer();?>
</body>
</html>
TUTORIALS
Now you’re done with the old index.html file. You can close it along with other
files in your theme folder except for header.php and index.php. They still have
some work to do.
In the header, all you need to do is change the style sheet from HTML to
WordPress format. Look for an existing link in the <head> section. In my case,
it’s something like this:
Let’s turn to the index.php file. It should be blank at the moment, so copy and
paste these lines of code:
This code will call for the rest of your WordPress files. You should notice the
space between the header and the sidebar. It’s where you’ll add The Loop.
The Loop will process each post for display, and format it according to how the
content matches the criteria within The Loop tags. It’s an important aspect to
add dynamic content to your WordPress site.
To do so, paste the following code right after <?php get_header(); ?>:
After you finish creating the basic theme, you can upload it to WordPress. All
files inside your theme folder must be in the same place. To do that, you can
zip them.
In the menu, locate your theme’s zip file, upload, and click Install Now. After
that, don’t forget to activate the theme.
Now your front end should look like the old site. You should be aware that
while the basic design looks the same, there are more things you should do to
make the integration better.
For example, you can’t use WordPress features like the widget area. You also
need to adjust CSS markup to make it a part of WordPress’ original design.
If you’re okay with leaving behind the old HTML website design and want to
use a new theme instead, this is your option. This method will also make
importing content much easier.
All you have to do is to install and activate the theme you prefer and follow
the steps below.
Important: Always backup your WordPress site before making any change.
TUTORIALS
You need to install the Import Plugin 2. Go to Plugins -> Add New and search
it by name. You’ll find it a little bit further down as it’s quite an old plugin but
still does a great job. Click install and activate it.
Now, go to WordPress Settings -> HTML Import. You can import several pages
at once or one at a time.
You’ll notice that the plugin points to a specific path like html-files-to-import.
It means that you need to upload the HTML file to the same server as your
WordPress installation. In case you need more details, you can refer to the
official user guide.
In this tutorial, we’re going to import the content. To do that, choose the HTML
tag at the top and select its configuration in the following three fields.
TUTORIALS
The Import Files button will be available once you save the settings. If you
missed it, you can also access it from Tools -> Import and click Run Importer
under the HTML options.
Choose if you want to import a directory of files or a single file, then click
Submit. Once done, all of your existing content will be available on your new
WordPress site.
If you want to retain some of your old website’s design but feel the first
method is a bit overwhelming, then using a child theme can be a simple
alternative.
You can also make changes to the appearance of your site without disturbing
the parent theme’s core. You won’t lose any modifications made when
updating your theme.
Important: Always backup your WordPress site before making any change.
1. Pick a Suitable Theme
TUTORIALS
You need to find a suitable theme as a base for you to build on. It will be great
if you can find a theme that’s close to your old website design, so you don’t
have to change too many things later.
2. Install Childify Me
Go to Plugins -> Add New and search it by name. Install and activate it.
Now go to Appearance -> Themes. Make sure that the parent theme is
activated. Click Customize, and navigate to the customization panel of your
active theme.
Click the Childify Me button, and give your child theme a name. We suggest
you name it similar to the parent theme. Click create. Once you’re done, click
activate and preview.
TUTORIALS
Now that your new WordPress site looks like the old static HTML version, all
that’s left is to import the content. Here, you can use the previous method.
Conclusion
Huff, that’s a long one. We’ve covered what needs to be done before
converting a static HTML site to WordPress and the different methods of
completing the process.
A quick recap – you can create a WordPress theme from scratch. It’s a difficult
method but a great option if you know how to code and have some spare time
to invest.
Alternatively, you can also use plugins to make the conversion a lot easier, and
import all of your content to its new home.
We hope that this article helps ease the process. See you in the next one!
The Author
Luqmanul M. / @luqman
Luqman is a self-proclaimed social scientist. He is passionate about education, technology, and everything in
between. He wants to help create a high-quality education system. Having spent the past four years as a social
TUTORIALS
researcher
and blog guru, he lends his skills to Hostinger's digital content team. As for free time, he enjoys reading
scientific (and not-so-scientific) literature with a cup of black arabica coffee as a companion.
Featured tutorials
Read More →
21 Aug • WORDPRESS
Read More →
12 Jul • DOMAIN
Read More →
Related tutorials
TUTORIALS
Introducing LiteSpeed – Your Go-To How to Start a Blog: A Quick Guide for
Website Optimization Tool Beginners
16 Mar • WORDPRESS
Read More →
Leave a reply
Comment*
Email*
By using this form you agree with the storage and handling of your data by this website. * (You need to accept this checkbox.)
Submit reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Website Builder
Tutorials
Blog
TUTORIALS
TUTORIALS
Hostinger is a leading worldwide cheap web hosting provider for millions of smart people, who really love to save a lot without losing high-
quality & premium webhosting features.
And More
© 2004-2020 hostinger.com - Premium Web Hosting, Cloud, VPS & Domain Registration Services. Prices are listed without VAT