Convert a static website to WP

Convert a static website to WP

I have an old client who wants his website converted into WordPress; so he can make edits independently.

I've decided to use this task as a teaching opportunity and document the steps in converting a static site to WordPress.

How to Convert a Static Website into WordPress, using Advanced Custom Fields:

1. Pick a static theme to convert

Static Theme
Static Theme

2. Download underscores.me or any blank starter theme

underscores.me
underscores.me

3. Create a database in your hosting account; where the website is currently being hosted.

Add Database
Add Database

4. Download WordPress, Upload the downloaded WP files via FTP to your hosted folder

4a. While in the root folder, Move the current static files into a new/separate folder if desired, so its easier to distinguish Static vs WP)

Download WordPress
Download WordPress
Upload WordPress to your Server
Upload WordPress to your Server

5. Upload your blank starter Theme to: /wp-content/themes/

WordPress Theme
WordPress Theme

6. Open your static index.html file + header.php, footer.php files.

7. Copy the header tracking scripts (e.g., Google Analytics) & any static assets to the header.php file

Copy Scripts + Tracking

8. If the scripts aren't absolute, add a connector; Otherwise you'll generate 404s

<?php echo get_stylesheet_directory_uri(); ?>/

echo get_stylesheet
echo get_stylesheet

9. If this a quick and dirty build, replace the dynamic Nav with a static Navigation found in the static files.

10. Repeat adding footer scripts to the footer.php file, remove duplicate assets (assets already present in WP)

11. Create a page-home.php file. Add the header and footer connections:

get_header();
get_footer();

Add additional templates if needed, for this example I'm only creating a one page site. Giving you a general idea of the steps involved.

page-home.php
page-home.php

12. Copy the static code within the opening and closing body tags into the page-home.php file you created.

Copy code inside opening<body> and closing </body> tags
Copy code inside opening<body> and closing </body> tags

13. If you haven't already, Add a template name to your page-home.php file.

Template Name
Template Name

14. Using your database credentials, install WordPress. You do this by going to your website: domain-example.com

Template Name
Install WordPress

15. Login and fix the Title Tag + Permalinks. Removing "Just another WordPress site" and setting pretty permalinks.

Settings >> General >> Tagline

Just another WordPress Site
Just another WordPress Site

Settings >> Permalinks >> Post name

Pretty Permalinks (post name)
Pretty Permalinks (post name)

16. Select your custom theme

Appearance >> Themes

17. Create a Home page (Delete the generic Sample Page created by WP)
Select your homepage template under Page Attributes.

Custom Template
Custom Template

18. Set your homepage as the front page.

Settings >> Reading

Reading Settings
Reading Settings

19. Move your static assets to the theme folder.
Check the homepage, fix any errors populating the inspector.

Move Static Assets to Theme Folder
Move Static Assets to Theme Folder

Installing ACF

20. Install the Advanced Custom Fields Plugin

Install ACF
Install ACF

21. In ACF settings, Add a Custom Field Group

This groups all of your custom fields in one place. Create additional Field Groups if you need to make additional templates/pages.

New Field Group
New Field Group

21. Create Custom Fields for the HomePage.

Creating a field for every part you want editable in the backend of WordPress.

ACF Fields
ACF Fields

22. Set the page location you want the ACF fields to populate.

Set Page Location
Set Page Location

23. Add the text and images to the AC Fields (before replacing content with ACF codes; this will make your life easier)

Text Fields
Text Fields

23. Replace the Static Code with ACF Fields

Replace static code with ACF fields
Replace static code with ACF fields

Code examples:

24. Test your new page; checking for formatting errors.

I hope this helps speed up your development process.

For a deeper explanation of installing ACF, please read: How to Install ACF