[wp-trac] [WordPress Trac] #18561: Better Way to Insert Things Below Individual Posts

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 1 04:28:15 UTC 2011


#18561: Better Way to Insert Things Below Individual Posts
-------------------------+------------------------------
 Reporter:  jane         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  3.2.1
 Severity:  minor        |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by Otto42):

 I would suggest adding this to the end of the get_template_part function
 instead.

 {{{
 do_action( "get_template_part_{$slug}_after", $slug, $name );
 }}}

 (what the name of the hook actually is is dealer's choice)

 This would allow a plugin to hook into a common place, if the theme is
 using get_template_part included files. For the specific case of twenty-
 eleven, it's using get_template_part('content', 'single') to include the
 content at that point, and an after action hook would allow you to put in
 something after the content part.

 There's already an action hook at the top of the function that can be used
 for the "before" part.

 This wouldn't work on all themes, but it would provide a mechanism for
 hooking before and after any use of get_template_part, and a naming scheme
 could quickly emerge among themes for part-naming, allowing for an ad-hoc
 standard.

 Furthermore, the plugin could only hook on specific "names" if it chose
 to, behaving differently for single post pages vs. post formats on the
 home page, etc.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18561#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list