[wp-trac] [WordPress Trac] #13265: Filter results of get_page_templates()

WordPress Trac noreply at wordpress.org
Tue Feb 25 18:32:48 UTC 2014


#13265: Filter results of get_page_templates()
-------------------------+-----------------------------
 Reporter:  nathanrice   |       Owner:  nathanrice
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Future Release
Component:  Themes       |     Version:  3.0
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  template
-------------------------+-----------------------------

Comment (by downstairsdev):

 Replying to [comment:42 GaryJ]:

 That's the use case I have with a project.  I'd like to make certain page
 templates in the theme available only if portfolio post types are active
 on the site.  I'm working around the lack of filter with javascript for
 the moment:  http://wptheming.com/?p=14753

 Below I attached plugin that uses the page_templates filter to remove a
 template from TwentyFourteen from the drop down list (page-
 templates/contributors.php).

 If that specific template has been selected for the page the #page-
 template select box will default to "Default Template".  However, the
 actual template loaded on the page does not update until the post is re-
 saved.

 I also tested @wpsmith's plugin.  I was able to select the "test" page
 template successfully from the admin- however, the template did not appear
 to load "test.php" template on the front end.  Perhaps a little more work
 is needed?  I'll see if I can find a solution.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/13265#comment:43>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list