As Pages are a special built in Posttype, they get an own template hierarchy. Other “normal” post types and custom post types can only be templated by “single-$posttype.php”. You can however hook into the single_template filter and make wordpress redirect to your template file:
function get_custom_post_type_template($single_template) {
global $post;
if ($post->post_type == 'account') {
$located = locate_template( 'account-'.$post->post_name.'.php' );
if ( !empty( $located ) ) {
return $located;
}
}
return $single_template;
}
add_filter( 'single_template', 'get_custom_post_type_template' );
I didn’t test this, but it should work ^^
Happy Coding,
Kuchenundkakao
Related Posts:
- What does this PHP function code mean? [closed]
- Restrict custom post type to only site administrator role
- Linking Two Post Types
- How to force one column layout on custom post type edit page?
- previous_post_link() and next_post_link() with a custom post type?
- Setting a custom sub-path for blog without using pages?
- modify all posts of a category to “no comments allowed”
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- Showing current taxonomy terms
- automatically create taxonomy with same name as post title
- Assigning a role to a specific custom post type (and ignoring other post types)
- Display posts in random post types
- Custom Post Type by user
- saving custom post type data to different table in wordpress
- Query post types with multiple keys
- [Plugin: Posts 2 Posts] Changing display order of connections
- same archive template for different custom post
- Get all posts WHERE custom_field is LIKE value
- Get the post children count of a post
- How to delete all posts from a custom post type?
- Check Title Unique Or Not and If not error message and dont save
- Remove All, Published and Trashed Post Views in Custom Post Type
- How to post twitter like updates on wordpress
- Show Two custom Post type and their posts on category page
- Trying to edit the single page from a Custom Post
- apply filters only to specific post listing without check the url parameters
- Custom post type and body_class: Remove “blog” class
- Deleting Custom Post type data using mySQL command
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Display only one post each WEEK
- List custom taxonomy specific to one custom post type
- Meta query for custom post type ignored in main query
- 2 Templates 1 custom post type according url
- Show titles, date of all posts on single category page
- Update postmeta Parent when post_status child change
- Allow users to create posts without logging in?
- Migrating a taxonomy’s tags to the native category
- How to sort posts in a custom post type by title in ascending order by default?
- Creating separate feeds for custom post types
- Get_the_terms restrict output
- Custom post type menu
- YOAST SEO won’t work on custom post type archive [closed]
- Separate Content from gallery (custom post type)
- How to get the current category with custom posts
- WordPress Count posts within a custom post type
- Template code to split a post and print a custom field?
- Displaying a list of Contacts
- Custom post type tags not showing in search
- How set template for “custom post type” individual post
- Why is my custom post content only viewable when signed into WordPress?
- Post template with breadcrumb needs to show page navigated from
- Post template not applying on theme (potentially rendering as Page template)
- Custom post type defaults to index.php for archive page
- Adding specific custom fields (images) to post excerpt
- Assign for all post of a post type a specific single-post template
- Limit posts per page depending on the size of a div?
- Delete Post by User
- creating a custom post template
- Problem to get the link of the default ‘post’ post type like the orther custom types
- Custom post type with two templates
- One Post with different content, depending on a Page
- Custom Post Type
- Why isn’t my custom post type using the corresponding custom post template?
- Search page for custom post type
- Display all post types together
- Turn post into simple slideshow
- Specifying Default Template for Hierarchal Custom Post Type [duplicate]
- Query multiple post of which one by taxonomy
- Apply text based styling done for a single post in WPBakery to all posts / create a template out of it [closed]
- How to delete unnecessary custom post types in the UI
- How to create a job post by email parsing? [closed]
- show posts under custom post type with same autj
- How to automate the creation of advanced layout article/post
- display posts, pages and custom post types from another wordpress site
- is therer any wordpress function to retrieve a specific html element from post content
- How to develop Knowledge center in WordPress Website
- ACF – Tags not showing up in Custom Post Types
- WP_Query Pagination on single-custom.php
- Prevent pre_get_posts filter on specific post type
- Custom Post Type with Custom Title
- How can I customize “Pages” admin (edit.php) and “Edit Page” admin (post.php) for bulk edit of custom content type?
- Best practice for adding posts in bulk
- How do I move/order posts with a tag to the end?
- WP_Query custom post type query not showing the exact post type
- How do i search authors from search form using author’s name
- Is it a good idea to add a column to the posts table?
- Move Genesis Single Page/Single Post Title
- How to get_term_meta on single custom post?
- How to use single.php for creating, reading and editing Custom Posts with ACF
- Assign a template to a custom post type when displayed by the main loop on the home page
- The loop does not show users
- Front-end Image Upload to Custom Meta Box
- Placing Admin Post Metaboxes in Tabs
- Right way to store a large set of similar information on website? [duplicate]
- get_permalink() of page the enclosing page not posts
- How to Create a Default Fixed Custom Posts layout for text and images
- How to hide home title on pages and posts?
- WP_Query is getting the post but the_post() not rendering any Post
- Delete old thumbnail when updating new
- Sort ACF by custom taxonomy