Answer the question
In order to leave comments, you need to log in
How to create a new content page?
Good afternoon. I pulled my layout on wordpress, I want to add a new page, I write a title, an article, I publish it, but the site has an empty page. It's the same with recording.
I made the template myself, I wrote in the template file:
<?php
/*
Template Name: Мой шаблон страницы
Template Post Type: post, page, product
*/
?>
Answer the question
In order to leave comments, you need to log in
Let's define what a page is and where it can be.
If you create a page, it won't show up on the site because it's a page. To open it, you need to follow the link that she has.
And now to posts, to show posts on your site, you just need to take a ready-made post output loop and paste it into your index.php.
Here is an example of displaying records:
https://wp-kama.ru/id_767/3-sposoba-postroeniya-ts...
1) It is not necessary to create your own template for each page if you do not want to customize the output of the content of this page. Accordingly, the template you created, in which, by the way, you added only the title (comment) and forgot to display the cycle, is not needed. You probably have index.php page.php and other templates according to the WP template hierarchy that will display the content of your page. You do not need to select these templates. They "grab" automatically. To obtain information about the template used, download the Query Monitor plugin
2) If you still decide to create a template, I recommend reading the WP code, familiarizing yourself with the template hierarchy and their correct names. For example, page-{ID}.php page-{slug}.php etc. And of course, do not forget not only to create a template, but also to display the main loop.
Simple example:
<?php
/*
Template Name: Мой шаблон страницы
Template Post Type: post, page, product
*/
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content (); ?>
<?php endwhile; ?>
<?php endif; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question