'Creating a plain html home page AMP with WordPress running the other pages

Gday

I like to know how you would go about creating a home page in plain html and have WordPress run the other pages?

The reason is I’d like to create a solely plain html website but I need WordPress for my contact page it has a large form on it and I use a plugin to generate it and forms are a bit beyond my knowledge at the moment to create a contact page myself.

(I have tried creating a template page but then WordPress adds unnecessary code [from plugins ] and makes the AMP invalid)



Solution 1:[1]

Honestly I'd try and keep it self contained in WordPress itself.

If for some reason you really want a separate HTML/PHP Homepage, follow these steps:

  1. Add a my-homepage.php file to your /wp-content/themes/ACTIVE-THEME directory

  2. Inside that file put the following code:

  3. Add a new page (Pages > Add New)

  4. Give it a recognizable name like "My Homepage"

  5. In the "Template" selector on the right hand side, pick "My HTML Homepage" and click Publish

  6. Go to Settings > Reading, change Your homepage displays to A static page and pick the page you just made

Now you can add your own code as you see fit. Nothing "WordPress" related will get loaded or hooked in since there's no functions on that file - so you're free to code HTML (or PHP) to your heart's content.

You can see a bit more indepth answer over on WPSE: https://wordpress.stackexchange.com/questions/296592/how-to-use-custom-html-file-instead-of-wordpress-homepage

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1