[wp-trac] [WordPress Trac] #21506: Standard Theme Hooks

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 7 02:10:55 UTC 2012


#21506: Standard Theme Hooks
---------------------------+-----------------------------
 Reporter:  mfields        |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Bundled Theme  |    Version:
 Severity:  normal         |   Keywords:  dev-feedback
---------------------------+-----------------------------
 During the hack day at WordCamp SF, Konstantin Kovshenin and I sat down to
 work out a solution to allow for better communication between themes and
 plugins. We propose that core introduce 4 new hooks into the default
 WordPress themes allowing plugins to add custom markup relative to common
 theme elements. While many other theme locations could be recognized, we
 have only included hooks that we could provide at least three use common
 use cases for.

 header_after: Allows custom markup to be inserted after all visual header
 elements have rendered. Possible use cases for this hook include:

  * Breadcrumb navigation.
  * Links to social profiles.
  * Advertising.
  * log in/out form.

 post_after: Allows custom markup to be inserted after all visual elements
 have rendered for the current global post object. This hook would fix the
 issue originally reported in #18561. Possible use cases for this hook
 include:

  * Sharing links.
  * Related posts.
  * Ratings.
  * Author bio.

 comment_after: Allows custom markup to be inserted after all visual
 elements have rendered for the current global comment object. Possible use
 cases for this hook include:

  * Upvote/Downvote control.
  * Ratings.
  * Show/hide threads functionality.

 footer_after: Allows custom markup to be inserted after all visual
 elements have rendered for the footer. While this action is similar to
 {{{wp_footer}}}, it would be possible for the theme author to move this
 into nested html elements. To my knowledge, {{{wp_footer}}} is intended to
 fire immediately before the closing {{{body}}} tag. Possible use case for
 this hook include:

  * Links to social profiles.
  * Advertising.
  * The "small print" or copyright information.

 If standardized hooks such as these were recognized by core, it would also
 have a positive effect on child theming. Theme authors would no longer
 need to override entire files just to introduce an element of two.

 We have prepared 3 patches for the default themes to demonstrate placement
 of these hooks as well as a plugin to demonstrate their usage.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21506>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list