V
V
Valen962018-03-27 13:19:29
WordPress
Valen96, 2018-03-27 13:19:29

How to make a page template in Wordpress (what's wrong)?

Tell me, there is a custom post type staty, I created a template in the theme folder and added the code
<?php
/*
* Template Name: Page for the article
* Template Post Type: staty
*/
?>
as a result, I can use the template for the article, but it is not displayed (everywhere the transition to the main page), tell me what's the trouble? the url site.name/staty/statya-1 is formed, but the main page of the site opens after the transition.
Two or three days ago I did exactly the same operations with another category of records, it works there, but here I do it by analogy - no.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Orkhan Hasanli, 2018-03-27
@azerphoenix

Hello!
No code needed. If you need a template for a custom post type, just name it properly
single-staty.php

V
Vitaly, 2018-03-27
@ya-vitaliy

As far as I know, this is not how a template for a single page is done (this only applies to pages). You need to create a file called single-{post-type}.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question