-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardized "Meta" Hooks #9
Comments
Hmmm. This definitely bears some further thinking -- most of (if not all of) the rest of the hooks have been of the positional variety, while these are more semantic. Can you think of some other such "meta" hooks that would make sense in your typical use case? |
This definitely moves away from template location-based action hooks, into contextual content filters. If we can standardize on these as well, it can only help the overall goals of the project. The only problem is that implementing such filters universally would be much more tricky, because while adding in a That said: most Themes that currently implement custom hooks implement both action hooks and filter hooks. So, adoption of standard filters would be simple. Here are all the filters I currently use in Oenology:
Definitely So, here would be my starting list of suggested filters:
|
I guess I see this from a plugin author's point of view (as someone who happens to write a very popular breadcrumb plugin), hence the specific example. Using a filter, to me, makes more sense for the specific case of breadcrumb navigation. A theme may provide basic functionality for this, but a more advanced plugin may want to replace the entire contents with its "better" trail. A filter allows this without having to know (or determine) the vendor specific function hooked and unregistering it. Initially, when I was thinking about this, the other uses were navigation related, such as archive traversal (older, newer post links, replacement with other things such as pagination) could benefit from this as well. Though, I agree with Chip's take on this. |
Absolutely! In fact, in Oenology, I use a similar approach (that will shortly be converted to a proper filter) in which I check for Yoast Breadcrumbs, and let it override my Theme's breadcrumb output. Using a filter would prevent Theme developers from having to check explicitly for every known type of Plugin - once Plugin developers implement the filter, of course. I think the navigation-related content would generally fit into filters such as In other words: as the Theme developer, I can decide where in the template I want the breadcrumb navigation to be output, while still enabling you, as the Plugin developer, to override the breadcrumb content (without needing to know where in the template that content is being output). Needless to say, I'd love to see this make it into the Theme Hooks Alliance code. |
Exactly! Doing this makes themes extensible in a practical manner and everyone's life a little easier. |
Someone throw up a pull request with perhaps an additional example file and/or a |
Just to add to the use cases: I needed a |
While THA currently provides a nice basic set of theme hooks, for some common theme features there is not an obvious choice to use among the existing hooks. Case in point, breadcrumb trails. While one could assume they belong within
tha_header_bottom
,tha_header_after
is still a valid location, as are a few other places. This ambiguity makes it difficult for plugins to hook into the correct spot (have to start making bad assumptions).It would be nice to have something like
tha_breadcrumbs
(preferably a filter). While a call to it could be placed directly within a theme (via something liketha_breadcrumbs()
), the way I see it being used is within a function that hooks into an already existing THA hook (such astha_header_after
). Hence why I called it a "Meta" hook.This was spawned by the discussion between Ryan and Brian on the WP Candy Podcast Ep. 34.
The text was updated successfully, but these errors were encountered: