If you are a WordPress developer, or are maintaining a site where you have to update page templates, one thing you would like to be able to have is a WordPress plugin to list all of the pages that a particular template is linked to.
For example, if you need to modify a template, you need to know which pages will be affected so that you can review them to make certain that your modifications didn’t break something.
I did a quick search for a plugin to do this and didn’t find any. I did find some articles with code snippets that showed the way, but didn’t quite go far enough. So I took those snippets and wrote a simple plugin.
The plugin adds a “Templates” sub-menu item under that “Page Menu”. Clicking the sub-menu displays a list of your page templates, and the pages that use each one. Note that this only lists the page templates. Those are the templates you see when creating or editing a new page in the drop down list in the “Page Attributes” section. On our site that list looks like:
The output of the plugin is this:
The above image shows a partial view of the report. You can see each template listed by both the template name and the filename of the template. Under each template is a list of links to the page and the status of the page (publish, pending, etc).
You can see how useful this is. If you are making a code change to a template file you can see which pages are going to be affected.
The plugin code for this is pretty simple. Feel free to look at it, modify the code, or install it. It is under the standard GPL2 license. Here is a link to a zip file with the code. You can also install directly from this zip file.
This is simple, and awesome! Surprised there aren’t things like this included in wordpress out of the gate.