Answer the question
In order to leave comments, you need to log in
How to create a page in a theme with a given template?
I’m creating a theme on wordpress, but I ran into such a problem, I can’t create a page with all the necessary settings when the theme is activated, the page is created, but I can’t put down the template when creating it... Maybe someone faced such a problem...
Answer the question
In order to leave comments, you need to log in
Hello!
In theory, if the template is named according to the page-slug.php principle, then the VI will automatically use this template for this page.
Another option is to include the template for the page via functions.php
To include a template file, you need to prescribe
<?php
/*
Template Name: Page template name
Template Post Type: post, page, event
*/
?>
The file name does not seem to play a special role. The second line c Template Post Type allows you to specify the types of posts for which this template can be applied. If you leave only the Template name, then the template will be applicable only for pages
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question