Using body_class() on the body tag would probably be the easiest way to tell which template is in use.
<body <?php body_class(); ?>>
Depending on which page you are on, it will output similar to this
<body class="page page-id-10 page-template-default logged-in">
Where page-template-default is the template in use. It’s also useful for blog posts and custom post types.
Related Posts:
- How to Add Custom Taxonomy To Woocommerce Plugin
- Quick edit screen customization
- Mini-Site Strategy
- Prevent trash/delete action on specific post types
- Loading custom page template via plugin
- Why The Init Hook For Custom Post Types
- register_taxonomy with multiple object type and update_count_callback
- How often do you need to register_post_type?
- Render a different post/template from within the template_include action?
- How to use a dedicated template for the Custom Post Type from a plugin?
- Custom Taxonomy and tax_query Issue?
- Using posts and postmeta table to store custom Address Book Plugin data
- How to register custom post types in a plugin?
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Custom role capabilities to administrator not taking effect (no plugin)
- Hierarchical or Non-hierarchical Custom Post Type in Real World Example
- How to append element after thumbnail
- How could I create a ‘private comments’ section on a custom post type?
- handling csv data with a custom post type
- Custom Post Type | Fatal Error on register_post_type()
- Issue with pre_get_posts on custom post type archive pages
- Detect where custom post type is declared
- Metadata for a taxonomy – is there any WordPress way of doing this?
- Insert Multiple Post with Same Publish Button
- get_object_taxonomies() returns empty array for custom post type
- custom post type not showing in menu
- Add custom ID to CPT posts only create not update
- Add custom post type as submenu [closed]
- Unable to get Custom Plugin Options data
- What is the best practice for displaying my plugin content in themes?
- Add Custom Post type menu to another menu in specific location
- Problems wp_insert_post and save_posts filter
- wordpress remove views from action links in a custom post
- Send a conditional email notification when a custom field value changes in Post Type
- how to set a WP Plugin’s url
- Getting 400 Bad Request on AJAX Call
- detect your custom post type in WordPress
- Option page’s form doesn’t work
- How can I include active content in a custom post type?
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Add to ‘action’ within post.php to allow more actions when editing a Custom Post Type in a plugin
- ajax response not recieving
- Add post type pages with plugin
- Create a select metabox that the user can pupolate?
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- CPT to installable Plugin
- Most viewed post of custom post type
- filter the_content, custom post type, and wp_query
- Fill custom fields when saving custom post types
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Custom post type page with parameter
- Custom post type category link redirecting to 404 page
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- Custom post category name showing empty
- How to show the post which checkbox is not selected
- Is it possible to get the specific content on the search page?
- Get next and prev item from custom WP_Query and Custom Post Type
- Replace Content of Sidebar on Custom Post Type
- How add Filter by Tags and by categories to custom post type in Gutenberg block
- Error 404 change permalink term custom term taxonomy
- Show a custom post title in another custom post type in Meta box
- Register custom_post_type from static function
- I have a random letter appearing before my content. Where to start looking for the cause?
- How to select meta key in custom database query
- Apply a custom Template to a Custom Post Type from within a plugin
- Restrict Custom Post Type to One Item
- How to seperate posts by categories?
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- Widget area for individual posts (custom post type)?
- Add an array as post content dynamically
- How can I load Template file from wordpress plugin
- Which File Populating CPTs in Slug URL
- Front End users account with lots of user Roles (not Woocommerce)
- How save custom meta type posts multicheck grouped by taxonomy (with CMB2) [closed]
- Custom post type that lets users create a set of posts?
- Foreach in get_post_types to apply a different filter per post type
- How to develop custom URL redirection
- In WordPress do I create tables for my plugin or do I create custom post types for a Student and Classes Registration system?
- Execute code only after user clicks ‘update’ button for CPT being edited
- Simple renaming my custom post type set with a plugin doesn’t work?
- Can the wp_posts table have the same slug (post_name) in multiple statuses (post_status)?
- Display custom post type archive on page.php template
- Associate custom categories to different user IDs
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Add category slug as class attribute in a link array
- Custom post types working in functions.php but not in plugin
- Resources to learn OOP for WordPress plugins, custom post types, etc
- How to dynamically register custom post type
- Menu Structure and URL structure, with Pages and Post-Type-Posts
- Custom Post Type urls not working
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs
- Custom post type template not loading from plugin
- Redirect to All Custom post types
- I am having a problem with fetching product data in the Gutenberg block editor
- how can i call archive-{post type}.php template from my custom plugins to my theams?
- REST API callback function is not called
- Display box in sidebar of custom post type
- Add taxonomy or category slug to custom post types URL
- Redirection after saving a post
- How to fix post_tags not showing for a CPT in new post for a custom user role?