[wp-trac] [WordPress Trac] #18561: Better Way to Insert Things Below Individual Posts
WordPress Trac
wp-trac at lists.automattic.com
Thu Sep 1 21:44:51 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 KMBredt):
What about a more extreme-version of the get_template_part by introducing
an selector-approach probably known from jQuery. I stumbled upon it, while
dealing with the Infinite Scroll plugin, although they are using it on the
client-side, a server-side version should be able to provide what's needed
(if that is even possible). Instead of targeting specific files one could
target a <div> with a certain ID or other HTML-elements with IDs or
classes.
You would have a function (e.g.: wp_selector()) which has at least three
arguments. One for what to select (to help theme- and plugin-developers a
CSS/jQuery-syntax is probably preferred), one to decide if the content or
the actions, which should be inserted or happen, are inserted/do happen
before or after the found selector, and the third argument gives the
content or action.
For example:
{{{
wp_selector('.postmetadata','after','gplusbutton');
}}}
Plugin-developers would need to add an option or two to let the
designer/user insert the specified selector to satisfy all needs. This
should make it very easy to set the right hooks at the right places.
Perhaps a fourth option could add a z-index-like approach to deal with
plugins rooting for the same place.
If the selector is not present or couldn't be found a more common hook can
be set as a fifth argument and act as a fallback.
Please note, that I have absolutely no clue if this is even technically
possible.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18561#comment:71>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list