[wp-trac] [WordPress Trac] #16264: Add function get_pages_by_template()

WordPress Trac noreply at wordpress.org
Sat Feb 14 15:11:24 UTC 2015


#16264: Add function get_pages_by_template()
-------------------------------+------------------------------
 Reporter:  mikeschinkel       |       Owner:
     Type:  feature request    |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  3.1
 Severity:  normal             |  Resolution:
 Keywords:  needs-refresh      |     Focuses:
-------------------------------+------------------------------

Comment (by MikeSchinkel):

 Replying to [comment:13 F J Kaiser]:
 > I'd at least vote to return the full `\WP_Query` object and not just the
 `$result->posts` property. Having access to the WP loop with `if (
 have_posts() )` is a bonus and it's usage should be encouraged.

 Hmm.  In that case I'd argue for `$args['output']` where the default is
 `$result->posts` as I don't see it likely that this function would be used
 with The Loop.

 > The filter itself imho is useless. There's pretty much no chance to
 really pinpoint a specific call in its current state. Every callback would
 affect any call to the function everywhere. If there really has to be a
 filter, then I'd at least add the template name as second arg.

 Sure.

 > About the arguments: I'd drop the `.php` extension from the input. That
 could - if there really needs to be a filter - also used as second arg on
 the filter. And I still believe that `menu_order` would be much more
 appropriate than using a publish date for orderby.

 Sure.

 BTW, my use case for this was to displaying different data entry screens
 based on ''"Page Type"'' in the admin and in `page[-*].php` so order was
 really irrelevant.  Instead I just cared to find the template based on
 post ID.

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


More information about the wp-trac mailing list