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

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 20 20:41:07 UTC 2012


#21506: Standard Theme Hooks
---------------------------+------------------------------
 Reporter:  mfields        |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |
---------------------------+------------------------------

Comment (by mfields):

 > Replying to [comment:23 greenshady]:
 > I'd say wrong. We need that hook for the simple purposes of a wider
 adoption rate by theme developers and to develop a standard. There really
 is no standard if theme developers are having to create custom hooks to
 match the "missing" hooks from WordPress.

 I do not feel that the hooks suggested here would affect the adoption rate
 or interfere with hooks that already exist in themes. Themes could retain
 the current hooks that they are using to provide similar functionality as
 well as support the standard. For existing themes, this is probably the
 best way to go without breaking backward compatibility with custom plugins
 and child themes.

 Perhaps "after" is not the best naming convention. This relative
 relationship naturally suggests that something is missing. maybe it would
 be better represented as ()using westi's suggestion about functions:

 * wp_masthead()
 * wp_post()
 * wp_comment()
 * wp_colophon()

 There is no, before or after at all. Theme developers can use this
 function in the most appropriate place in their theme and plugins no not
 have to choose whether or not their markup should print above or below the
 element. The decision making is in the hands of the theme author.

 > The others are not used quite as much by users.

 The purpose behind this proposal is to make communication better between
 themes and plugins. The only situation I could see an end-user directly
 interfacing with these hooks is in a parent-child theme relationship. Is
 this where you see users using hooks?

 The problem that we would like to solve is plug-and-play functionality.
 This is why we've designed the hooks to support common functionality
 provided directly by plugins. Whenever I see "Open template-file.php and
 place the following code snippet in the appropriate place." in a plugin's
 installation instructions, I can't help wonder if there's a way to remove
 that step. Many end users are not comfortable modifying code and if there
 is something that we can do so that they do not have to, I think we
 should. A standard set of hooks is one method that could work.

 > But, probably the most-used of all hooks in my themes would be the
 equivalent of `content_before`.

 Interesting. What are some examples of the code printed using this hook?

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


More information about the wp-trac mailing list