0

I'm trying to set a wordpress static HTML front page, which doesn't seem trivial.

I tried three approaches:

1) add a index.html, and rename index.php to blog.php. Change the permalink into custom: /blog.php?p=%postid%. However for handling categories, the generated link is /blog.php?p=cat=3.

2) add a index.html, and rename index.php to blog.php. Change the installation position into www.mydomain.com/blog.php in my dashboard. This time it direct to www.mydomain.com/blog.php/?p=123.

3) add a page and set it to be displayed as frontpage in my dashboard/settings/reading. However for this solution, I don't know how to change the overall html of a page edited in wordpress. I can only modify the html for the body but I need to change it whole.

Any suggestions?

  • Have you tried leaving index.php alone and adding index.html? – Matthew Boynes Jun 3 '13 at 3:17
1

Temporarily change permalinks back to the default settings.

Create a page template and name it page_home.php. Add this to the file:

<?php

// Template name: Static Front Page

You can add code to display the page content later. Like the contents of the index.php file.

Save the file to your theme (or child theme) directory. Create a new page, name it and select Static Front Page from the Template dropdown. Publish the page and select it as your front page in the Settings -> Reading page.

You can add code to the template file to affect the front page style like any other template file. http://www.mydomain.com/ should go to your front page.

Now you can muck with permalinks settings if you wish.

  • You shouldn't even need to change permalinks settings to implement this setup. Creating the new page & setting it up to use your template file, and then setting WordPress to use this new page for the front page, should have no effect on permalinks. – Christiaan Jun 3 '13 at 3:54
1

Seems like there's an easier way to do this.

You only need to change the name of index.html into anything different (like mylanding.php or whatsoever).

Then you put this file into the folder of your active theme and edit it by adding this line to the very beginning:

<?php /* Template Name: mylanding*/?>

Now create a page with any random name and content or edit an existing one. The main thing here is to choose the template "mylanding" in the right column.

Go Settings —> Reading and set this page as the front one.

How to Add a Static HTML Page to WordPress

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.