[wp-trac] [WordPress Trac] #40258: Add hook for get_template_part

WordPress Trac noreply at wordpress.org
Sun Aug 6 22:02:03 UTC 2017


#40258: Add hook for get_template_part
-------------------------+------------------------
 Reporter:  tazotodua    |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Themes       |     Version:
 Severity:  normal       |  Resolution:  duplicate
 Keywords:               |     Focuses:
-------------------------+------------------------
Description changed by SergeyBiryukov:

Old description:

> We frequently use themes, which themselves use
> `get_template_part('smth1/smth2')`
>
> however, i many cases, we want (from custom plugin) to avoid inclusion of
> specific template parts.
>
> there seems no solution, rather than manually modifying themes inner code
> to avoid getting that particular template part.
>
> It will be better if there was a hook:
>
> function get_template_part( $slug, $name = null ) {
>
>     .....
>     $slug =apply_filters('get_template_part_filter', $slug, $name);
>     if(empty($slug)) return;
>     ........
>
> }

New description:

 We frequently use themes, which themselves use
 `get_template_part('smth1/smth2')`

 however, i many cases, we want (from custom plugin) to avoid inclusion of
 specific template parts.

 there seems no solution, rather than manually modifying themes inner code
 to avoid getting that particular template part.

 It will be better if there was a hook:
 {{{
 function get_template_part( $slug, $name = null ) {

     .....
     $slug =apply_filters('get_template_part_filter', $slug, $name);
     if(empty($slug)) return;
     ........

 }
 }}}

--

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


More information about the wp-trac mailing list