Creating custom page

Even if you will keep your content static, you must create the pages through wp-admin. It’s the right and easiest way. After that, you have some options of how you will keep your content static:

Page template

You’ll create a file into your theme folder with your static content, starting with this piece of code inside PHP tags:

/* Template Name: Enter your template name here */

In wp-admin, create a page and select the template with the name you wrote in the code above

Whenever someone hits your page, wordpress will render the content of the file with the selected template name.

Matching the page slug into the file name

After creating a page in wp-admin, you will have a slug to it. The slug is the part of the URL that points to your page. For example in yousite.com/your-new-page, the ‘your-new-page’ part is your slug. So, if you create a file called ‘page-your-new-page.php’, this will be the file rendered by wordpress whenever someone enter in the above URL.

Matching the page ID into the file name

The same way as in slug, after creating a page in wp-admin, you will also have a ID to it. You will found the ID looking in the wp-admin page edit URL. For example: yoursite.com/wp-admin/post.php?post=50&action=edit. Your ID is 50.

In the same way we did with slug, you will create a file into your theme folder called ‘page-50.php’. That way, whenever someone access yousite.com/your-new-page, wordpress will identify that it’s the page with ID 50 and will render the content of page-50.php

I recommend you to read about the wordpress hierarchy (https://developer.wordpress.org/themes/basics/template-hierarchy/)

Hope it helps. 🙂