WordPress uses a template hierarchy to determine which template file to use to display a post or a page.
Posts, Posts, and Pages
In wordpress there are posts, and then there are posts. In other words, “post” has two completely different meanings in wordpress. A post is any type of content you might add to wordpress. It could be a blogpost, a page, a menu, a revision, an attachment… There are default wordpress post types, and there are also custom post types that can be added by themes or plugins. For example Woocommerce will add a custom post type of product. And all of these items are stored within the database table wp_posts.
What we normally thing of as a “post” is a blog post, which is one of the post types. The type of post is indicated by the field “post_type”, which contains an value that corresponds to a type of post. That value may be used to determine the way the post is presented.
A page is a post with a post_type of page.
You probably want a page to display differently than a post. To begin with, there are no categories for pages. It is also seldom necessary to display a page’s author, or the date published.
Create a file called page.php and save it. When you visit a page, the template hierarchy will find this and use it to display the page. Currently the file is blank, so clicking on the about link will yield a blank page. Add the following and save.
We can also create specific template files for pages. These are done using the page’s slug. Using the about page for example, we can create a file titled page-about.php. Copy the contents of page.php but add the following to add the company phone number to this page (and only this page):
We can also turn this file into a template file, so that it could be selected and used for other pages. To do that, get rid of the file page-about.php and create a new file called company-template.php. Add this to the top of the page:
You will now be able to select this template under Page Attributes >> Template.