Set front page as static page [closed]

A link that might help you a lot is the WordPress Template hierarchy, see:
WordPress Template hierarchy.

In order to get a static front page, you should create a file called “front-page.php”. WordPress will use this file to show the frontpage, in case you have set the it in the backend options. Please see the image:

Statis Frontpage

If you are writing your own WP theme it is highly recommended to you have a deep a look at the WP hierarchy as well as the WordPress Theme Developer documentation.

The principle of WordPress – following conventions and offering a wide range of “Actions, Hooks and Filter” functions – instead of writing some own solutions will appear over and over again.

Another example would be page templates where WordPress uses “page.php” by default, and – in your case propably – you can extend on this by creating “page-templatename.php”.

It is also vital for the use of a (child theme), that you:

  • allow your theme to be translatable (I18N) by using .mo/.po files, translation catalogues and so on, and
  • that you make use of template functions like “get_template_part(‘filename’);”

One last tip, which I think is import to know is that WordPress has some priority mechanisms with the template files. It all makes sense if you look at the hierarchy.

The index.php is the fallback file for everything, but with increasing files in your theme folder WordPress becomes “more hungry” to load template files, which it can find, which is “front-page.php”.

So in order to feed WordPress correctly, all you need to do is to provide that file, with the correct naming for WP.

Ouhhh: and almost forgot it:

Browse the plugin directory for “What the file”.
Great plugin which will help you a lot by showing the current template names (index.php, home.php) in the right upper corner, when you are logged in and the plugin is activated.

What the file

I hope that helps.

Leave a Comment