WordPress already has an in-built function for determining if the current page is using a particular page template using the function “is_page_template()” while this function definitely serves a purpose.
Sometimes in an instance where you are using one loop file as opposed to multiple loop files you want to check if you’re on a page that is using a page template but don’t care what type of page template it is, this is where the function I’ve created below comes in.
It’s simple. You loop through all available page templates with a foreach loop and check if the current page is using any of the templates.