Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #14310, comment 44


Ignore:
Timestamp:
03/17/2013 08:59:53 PM (12 years ago)
Author:
louisremi
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14310, comment 44

    initial v1  
    1 It would be interesting to provide a generic filter that would apply to any $type.
    2 I'm trying create WordPress themes using client side frameworks (starting with AngularJS) and I need to recreate the locate_template logic on the client-side. This implies to always send the complete $templates array generated by get_query_template.
     1I'm trying to recreate the template hierarchy logic on a client side with AngularJS. I want client-side templates to be picked by the Angular router based on current path and naming convention using the same rules that are used by WordPress on the server side.
     2
     3The easiest way to achieve this is to get the computed array of $templates from the server side whenever the location path changes on the client side, then check which client-side template fits.
     4
     5This implies that a generic filter inside get_category_template can provide the $templates array corresponding to any $type.
     6Unfortunately I see no alternative to this filter, and if it doesn't make it in 3.6, I will have to write a plugin that overwrites the content of wp-includes/template.php. I know this is a bad practice but there is simply no other way that I can think of.