• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

I Like Kill Nerds

The blog of Australian Front End / Aurelia Javascript Developer & brewing aficionado Dwayne Charrington // Aurelia.io Core Team member.

  • Home
  • Aurelia 2
  • Aurelia 1
  • About
  • Aurelia 2 Consulting/Freelance Work

A simple function for checking if a page is using any custom post template in WordPress

General · October 22, 2012

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.

Dwayne

Leave a ReplyCancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular

  • Handling Errors with the Fetch API
  • How To Get The Hash of A File In Node.js
  • Thoughts on the Flipper Zero
  • How To Paginate An Array In Javascript
  • Testing Event Listeners In Jest (Without Using A Library)

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz