Hi @wildapache ,
You may check this: https://developer.wordpress.org/reference/functions/is_page_template/
Use is_page_template().
if ( is_page_template( 'about.php' ) ) {
echo 'This page uses the about.php template.';
}
If you only want to know whether the current page has any custom page template assigned, call is_page_template() without a parameter.
Oh, it’s a my mistake again
I have created a template but forgot to apply it to a page.
Now it’s work
p.s checked again is_page_template() do not work with combine is_page(), so you need just write
<?php if(is_page_template()) {... } ?>
instead of
<?php if(is_page() && is_page_template()) {... } ?>
because this doesnt work
-
This reply was modified 2 days, 7 hours ago by
wildapache.
If you just need to know if a page is using a page template and which one, give this plugin a try:
https://wordpress.org/plugins/what-the-file/
I find it to be quite handy on sites with many differing page templates.