Try naming it single-books.php. Normally when you register a post type it’s plural. Use the exact wording you registered the CPT with in your register_custom_postype.
I like to use namespacing to avoid these issues all the same. SO register wpse_books as the post type and then your single would be single-wpse_books.php and archive would be archive-wpse_books.php
there is no need to set a parameter to do this as wordpress will find the single/archive files based on the post name automatically.
You shouldn’t be adding the template names at the heads either. You can comment what it’s for but don’t say template as this could confuse things later.
Related Posts:
- Get all post types that supports tags
- Post types showing tables…Can I do that?
- Use register_post_type() to modify an existing post type
- Custom post type pagination 404 fix?
- Only get post types based on support
- Per Post Type Revision Numbers
- Get list of all registered post types slugs
- WP_Query ignores post_type in category view
- How to get only posts, pages and custom post types in WordPress
- How do I implement custom fields without using any plugins?
- custom post types don’t appear in RSS
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Registered Post Type Isn’t Showing in Admin Menu
- Multiple post type queries (with specific arguments for each)
- How to retrieve a custom post’s capability?
- Use get_post_types to query only custom posts types
- Adding `supports` array to WordPress custom post type
- WP_Query | ‘post_type’ doesn’t work
- Registering different Post Formats for Blog Post and CPT
- child of post type (custom)
- How do I set default meta value by post type?
- Limit amount of posts made within a custom taxonomy
- Incorrect post_type in url of taxonomy term
- Taxonomies relations
- How to define which register_post_status goes to which register_post_type?
- Is it possible to filter the display name for post formats for display in the Formats meta box?
- get_the_post_thumbnail_url(‘full’) returns empty from custom post type
- single-{post_type}.php not working
- How to Set Taxonomy Object Description?
- Show only public custom posts in home page
- Can I change my post type to anything and my site still work?
- post_parent in custom post type
- Custom filter for main search: how to exclude specific post_type from search results
- get_post_types – exclude multiple post types by name
- Remove taxonomies using register_post_type_args
- Custom post type and standard post not displaying or working
- post_type internal ID?
- How to manage selected post-formats in custom post type
- Dynamic pages for linked categories and content
- Custom post type in theme not appearing
- How to copy a custom field from the user’s CPT to the user’s normal posts
- get_post_types not working properly in admin
- Add filter to Admin list for all custom post types by their custom taxonomies
- Post Type => Any conundrum
- How to add Support to show Fullwidth Featured Image of Custom Post Types in WordPress.?
- How to hide list from custom post type
- Can I automatically assign a page template to a custom post type (i.e page-slug.php file)
- Why is my custom post content only viewable when signed into WordPress?
- Custom Post Type Single Page is not working
- Difference between a default post type and a custom post type?
- custom post type single page not found after aotumatic publish By the author’s robot
- Custom post type single with custom URL structure
- How to add custom supports for custom post types?
- How to mix 2 kinds of post types
- Change Custom Post Type to Post + Category
- Shortcode in excerpt
- How can i order my posts by post type?
- Permanent Custom Post Type
- Custom post type post_type_link gives “page not found” on any other custom post type
- custom post permalink
- do action inside a class is not working
- Updated from 3.8 to 4.2 and all post types changed to “post”
- Pulling in Related Posts based on Post Type array
- How to add gallery support to a custom post type?
- Custom post types & Thumbnails
- Custom Post Type supports author
- How would I get a list of posts from a custom post type
- How can I make a custom post type that loops pages in a new dashboard page, each single page is a new dashboard page (all within the back-end)?
- Why does ‘exclude_from_search’ exclude a custom post type from WP_Query?
- How to add post type in masonry posts elementory widget
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- custom taxonomy not return in the code
- Custom post type REST api 404: Updating failed. No route was found matching the URL and request method
- Query by post title
- Implementing “Video of the Day” Feature?
- Is it proper to create a page just to generate a listing page (eg. for a custom post type)
- How to quickly switch custom post type singular template?
- Best way to arrange custom post types by Attributes -> Order metabox value?
- CSS for Custom Post Types
- Turn query string to sub page
- Custom post type custom taxonomy archive page name
- Unable to retrieve any posts of CPT in wp-admin
- Custom post type templating problem
- Which post does a taxonomy term belongs to?
- Custom Post Type – No Results Found
- Custom posts type for individual pages?
- Post Type Support Array Not Working
- build Custom post type and make it child for Posts and put it as comment
- Disable button after one click per user per post
- How to return/export only data showing on screen in custom post type view all screen
- How can I add image sizes for a specific custom post type?
- Get all posts for custom taxonomy term
- $_POST from a Meta Box
- How to store additional data that is related to core data
- How to get a custom post type archive paged when using a custom field for post sorting?
- How do I retrieve the title of a term of a custom post type with custom taxonomies?
- Displaying WordPress Parent field in child post
- Paginating custom query on category template
- New WP_Query not isolating custom post types on front-page template