I
I
its_a_me_mario2021-11-11 16:51:57
WordPress
its_a_me_mario, 2021-11-11 16:51:57

How to add an additional page (for example, contacts) in a wordpress theme?

I can't figure out how to add additional pages. I made up the login page, registration page, main page and others. Threw in the topic. I was able to pull only the main one: I just threw it into the index.php of the theme, but I don’t understand how to add others, since in all tutorials they make up a landing page with one main page. Also climbed into the WordPress documentation, did not help.

Or, if it’s enough just to throw it into the topic: how to specify the path to these files so that you can follow the link to them

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2021-11-11
@its_a_me_mario

index.php is not a home page template, it is the most basic template and is used in case WP doesn't find a better one for the request. This template should have the most basic loop, and for the main one it is better to use front-page.php or home.php
To create a page with contacts, you can create a file with an arbitrary name, for example template-contacts.php . Be sure to start the file with the following lines and your layout

/*
Template Name: Шаблон с контактами
Template Post Type: page
*/

After that, in the admin panel, when creating a new post in the "Pages" section, you will have a select with the choice of the desired template
. In order for the customer to be able to change the information on this page, you can use the ACF or Carbon Fields plugins, they create fields that can be edited in the admin panel. The values ​​of these fields need to be displayed in your layout, then the information will be loaded from the database.
I advise you to read more about the template hierarchy , and to fix it, see how popular themes and default twenty

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question