How to detect if some page template has been selected

by valentina.a87   Last Updated April 20, 2018 11:08 AM - source

I'm wondering if, in the static front page, is possible to detect if the some page template has been selected for my page. I'm building a template and I'd like to have a static front page, but I'd like to load a particular page-template just in the case my client selected it in the page Attributes, otherwise will be load the standard page structure.

Is it possible?

Thank you for any help or clue!

Answers 1

sure it is possible. Just check the page meta field (assuming you're in the loop):

$template = get_post_meta( get_the_ID(), '_wp_page_template', true );
Levi Dulstein
Levi Dulstein
April 20, 2018 11:11 AM

Related Questions

My custom template page not loading content inside it?

Updated November 15, 2017 10:08 AM

Page.php and index.php confusing me!

Updated April 01, 2017 19:08 PM

How to use our HTML pages and WP pages

Updated March 07, 2019 15:08 PM

Single page theme with page templates

Updated October 06, 2017 08:08 AM