If I am understanding you correctly you could use get_page_template_slug(). For example…
<?php echo get_page_template_slug( $post->ID ); ?>
Although, to be honest I don’t see the point of doing this over using body_class().
Related Posts:
- How to assign a class to a page with a custom template?
- Creating custom post-listing templates in twentyseventeen child theme
- How to use Class
in Java? - How to edit contents of dynamic_sidebar()?
- Where is get_header(‘shop’) file in Woocommerce templates
- Loading partial templates with AJAX/PJAX
- WP frontend output of custom textarea fields not respecting line breaks. In admin it’s OK
- Custom reset password template after forgot password request
- Child Theme: how to override variables?
- Where to store some per-template preferences?
- How to create tag.php
- How do I override template-tags.php in twentyseventeen theme
- Get template part vs locate template function
- Tools for Converting an Existing Website Design to a WordPress Template?
- author.php added to template not working on Nginx server
- roots child theme can’t override header.php
- wordpress – load a template based on the URI
- How to include template according to meta post value
- Using Includes in Templates in Document Head
- How to show scaled featured image in template?
- Load template inside a parent template
- Why isn’t is_page_template() adding a body class?
- Child theme TEMPLATEPATH issue
- Unable to create custom search results template page
- Which has more impact on site performance? Template overrides or hooks
- Updating modified templates
- Template for slug
- Hook to get the page template that is in use on the admin page edit screen?
- “Issues” loading MANY featured images on a single page (custom template)
- WordPress Shortcode wrap around div
- How to add an HTML tag to the Header?
- Where is the template for the ‘standard’ format of a post in the theme twentythirteen?
- Missing ‘Page Attributes’
- how to use custom page template in a page?
- include ‘wp_enqueue_scripts’ (CSS) to multiple templates
- Directly using pure JWPlayer JS (but NOT WP Plugin)
- Is there a way I can put my post templates in a separate folder?
- new page sidebar-template by default
- Login page theming?
- Get link to a specific template file [closed]
- I want to add a custom “all posts by author” by authors name. How?
- Default Template Selected After Changes in Elementor [closed]
- Include Custom Style & Script into Custom Post Type Single Template
- Standard WordPress Search does not work / Search-results are not displayed / Custom template
- How to preserve changes in templates and other files
- displaying category and subject posts
- Adding Query to Custom Page Template
- Whats the template of my homepage?
- Custom headers based on taxonomies
- Override Dokan Includes File in Child Theme
- How to get link to homepage
- How is WooCommerce cart.php template supposed to be used?
- Two exact templates, sidebar showing in one but not the other
- Taxonomy term page going to 404
- How can I use default CPT templates from sub-folder?
- How to set page title tag in custom template for non-Custom Post Type?
- Dynamically Insert Image Into Stylesheet
- Page header on specific page is different from the rest [closed]
- Can a link in WordPress contain a query string that is picked up as $_POST
- Create template for just a print
- dynamic_sidebar() stopped working
- Is it possible to access plugin data from a custom feed template?
- How can I get all archive-URLs to use the same template?
- How to use a template file to show all post having same metakey
- Automate configuration after new/hosted installation
- Sending email for the custom form in WordPress
- Hard Coding Components on a Client Specific Websites
- How to use another file instead of home.php
- Assigning custom page templates to a static blog page
- Can i exclude certain page templates for a specific role?
- Modify just ONE page based on a template
- Using a specific template for front page only
- which template does wp_ tag_ cloud point to?
- Pagination problem (plugin wp-pagenavi) with a custom post type?
- Add an anchor link to a ‘plain’ HTML file, without over-writing the entire site?
- Template part including not working
- Parent/Child themes – both CSS files loaded
- front-page.php includes a placeholder text field. How to get rid of it?
- Display a custom 404 page without a redirect
- How to add variables to a template
- Theme keeps going to default files [closed]
- How can I show contents of a template part inside of another page?
- Is it possible to set a custom post type template with code?
- How to serve a amp template
- Single page applications with WordPress: routes and templates
- Fix for Chart.js removing Admin Bar
- Why is this array not working?
- Single Post Templates Doubt
- strange behaviour of template_redirect in IE8
- How do i load a different template for different users screen width
- MailPress plugin: table inline style tag removed when sending the newsletter
- Duplicated Template Does Not Load the Same as the Original Template File?
- Custom Archive with Content for Custom Post Type
- Blog template PHP [closed]
- load_textdomain won’t load my .mo file
- Implement HEAD and TITLE tags with DB DATA
- Custom Post Type Trouble
- html blog template to wordpress template
- templates page not showing on gutenberg editor
- How to load php templates from html page (block theme)