A few months ago, WordPress UX Lead Jane Wells posted a request to WordPress' Trac ticketing system.  The idea was to find a better way to insert "stuff" below WordPress posts:

Inserting the sharing and like rows at the bottom of the post text before the byline/classification metadata seems wrong. It should go below that, so it is closely related to commenting, not part of the content itself. The plugin-generated widget is not "by" the post author, after all.

I haven't used very many social media plugins for exactly this reason.  Nor have I ever used a "related posts" plugin.  They always seem to conflict with one another and build up a bunch of unnecessary cruft below my content.

So for the past few months, I've been thinking about different ways to handle this.

[caption id="attachment_3933" align="alignright" width="300"] The Art of Manliness adds an author box, a Facebook "like" button, a related content gallery, and a subscription feature to the bottom of each post.[/caption]

Template Parts

My first idea was to just use a template region within a WordPress theme.

Each individual theme would call some variety of [cci]get_template_part()[/cci] to set up whatever region is being used.

Plugins would then provide content for these templated regions.  So [cci]get_template_part('social_media')[/cci] and [cci]get_template_part('related')[/cci], for example.

The problem with this, though, is one of standards.  What template regions will be supported?  How will new ones be developed?  After the battle over post formats, this isn't a particular standard I want to battle.

Post Intents

Another developer suggested modelling  system after the emerging Web Intents standard.

Basically, a new function would be added to WordPress to output various registered post intents - share this, "like" this, subscribe to updates, etc.

Individual plugins would then register these intents and their various actions, but leave it to the theme to style the presentation.

I was entirely sold on this idea.  Well, until a long Twitter conversation with Helen Hou-Sandi:

When you take things like photo galleries, related posts, and actions other than social media integration into account, the concept of post intents no longer makes sense.

New Action Hooks

[caption id="attachment_3937" align="alignright" width="300"] Chris Pearson add a personal "follow me" Twitter link, a "Tweet this" link, and several other action items below his posts.[/caption]

I love having a large number of action hooks to use when I'm building a theme.  I can move content around, add custom views to my content, manipulate the display.  The sky's the limit.

So when several developers suggested that we just add a few action hooks before and after the post content, I was intrigued.

But really, this is what themes are already doing.  And merely adding a few extra action hooks just gives plugin authors the ability to inject their own markup into the flow of your otherwise well-built design.

Considering some of these add-junk-to-the-bottom-of-my-content plugins already break the display, why would they function any different if I gave them a specific hook to tie in to?

My Proposal - Post Supplements

Instead, I have in mind a hybrid of a new action hook and registering a new object: post supplements.

Think about widgets for a second.  There's a specific area to display widgets (the sidebar), each widget is registered with WordPress and placed in this area, and a well-coded widget leaves much of its markup to the theme ([cci]before_widget[/cci] and [cci]after_widget[/cci]).

So think of two things:

  1. A new object defined by WordPress: [cci]WP_Supplement[/cci]
  2. A new action hook/function used by WordPress to output registered supplements in the theme

The theme can register supplements (one for sharing, one for related posts, one for a photo gallery, one for an about-the-author box, etc).  Various plugins can also register supplements.

Then, just like with widgets, these supplements can be added to the theme.

Widgets use [cci]add_action( 'widgets_init', create_function( '', 'register_widget("Foo_Widget");' ) );[/cci]

Supplements could use [cci]add_action( 'supplements_init', create_function( '', 'register_supplement("Foo_Supplement");' ) );[/cci]

Decisions, Not Options

I don't envision a UI for this feature.  Everything can be handled programatically - supplements appear on screen in the order in which they were added to the system.  Likewise, they can be unregistered the same way.

This keeps the WP interface lean and mean, but still gives us a more efficient way to add content to a post in exactly the place the theme designer intends: [cci]do_action( 'post_supplements' )[/cci] or [cci]wp_post_supplements()[/cci].

The theme designer would be in complete control of the position of these elements, what styling (if any) separates them from the content of the post, and what styling (if any) distinguishes them from one another.

This would be non-trivial to build, so before I dig in to the code I want to solicit feedback on the idea.

Does this make sense from a usability standpoint?