Reputation: 87
I got a new posttype called "butik". But I want to be able to edit the template for that post, right now it uses index.php, and I have tried creating single-butik.php but it still wont use that.
Can anyone help me?
Edit 1:
This is my function to register the post type:
register_post_type("butik", [
"labels" => [
"name" => "Butik",
"singular_name" => "Butik"
],
"show_ui" => true,
"supports" => [
"title",
"editor",
"thumbnail"
]
]);
Upvotes: 0
Views: 58
Reputation: 183
First, make sure that your post type is called butik exactly in your register_post_type function.
Secondly, if you're seeing index.php it indicates that wordpress is expecting to serve up the template that lists all posts within that post-type, otherwise it would be serving up single.php - which is used when wordpress expects to serve up an individual post.
These types of pages that list all posts are referred to as 'archive' pages, so instead try editing archive-butik.php
single.php displays one single post. Chances are the url doesn't specify an individual post.
Upvotes: 1