Wp Get Page Template

Posted onby admin

Description

Page

I have this issue where I need to get all page templates. I know there are ways to get them based on their name. I know that I can include a page template but I am trying to include them in the loo. The function getpagetemplateslug returns an empty string when the value of 'wppagetemplate' is either empty or 'default'. Custom fields starting with an underscore do not display in the Edit screen’s Custom Fields module. To retrieve a Page’s custom template metadata, you can also use: 1. It works very well and shows the WP Template file being used to render a particular webpage. My only gripe is that it is poorly documented. I had almost given up but this article by @lukefive which tells you how to enable the admin bar on the viewed page helped me get it working.

Getpagetemplates (WPPost null $post = null, string $posttype = 'page') Gets the page templates available in this theme. Page template in subdirectory #Page template in subdirectory If the page template is located in a subdirectory of the theme (since WP 3.4), prepend the folder name and a slash to the template filename, e.g.: 1 ispagetemplate ('templates/about.php').

A WordPress plugin which shows the current template file name, the current theme name and included template files’ name in the tool bar. If you like this plugin, you can buy me a coffee! 😉

Inspired by (and big thanks to):

Dark wp templates
  • https://gist.github.com/gatespace/4482529
  • https://wordpress.org/plugins/reveal-template/
Wp Get Page Template

Installation

The Good Way

  1. In your WordPress Admin, go to the Add New Plugins page
  2. Search for: Show Current Template
  3. Show Current Template should be the first result. Click the Install link.

The Old Way

  1. Upload the plugin to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

FAQ

I don’t see the toolbar.

Is the Toolbar (Show Toolbar when viewing site) option in your profile page is checked?
You can find your profile page is in your WordPress admin -> Users -> Profile.

Page

I don’t see the current template file name in the toolbar.

Wordpress Posts Page Template

Do you logged in as “Administrator”? Other role users like “Editor” can’t see the file name. If your WordPress is multisite, only super admin can see the file name.

I’dont think this plugin is working properly.

Please try below:

  • Activate one of the default themes.

Now the plugin work properly? Then it means there may be a compatibility issue between your theme and this plugin, so let me know your theme’s name and where I can get it.

  • Try to stop all plugins other than this plugin.

Wordpress Page Template

Now the plugin work properly? Then it means there may be a compatibility issue between one of those other plugins and this plugin, so let me know those plugins names and where I can get them.

Reviews

Wordpress Get Page Template Content

Super simple plugin which works perfectly. One of my go to plugins for developing.