I created a new custom type called 'books' and I created a Field using the Advanced Custom Fields plugin where I define the fields and create the records, with post names such as book1, book2, etc. I want to define a view for the elements of this particular custom type so when the visitor goes to website.com/books/book1 I will display information about book1. I tried defining single-books.php at the root of the theme but it didn't work. How can I define a template for the posts of a custom post?
Thanks
single-books.php
would be correct for a CPT namedbooks
. However you may want to double-check your code and adjust so the name isbook
singular. When you say you added the file and it "didn't work," what happened? Did you confirm that a different template was being used?example.com/books/book1
- it relies on having an actual post with the slug "book1".