Hybrid 0.7 survey results: Theme hooks

In the recent Hybrid 0.7 survey, I asked about action and filter hooks in the theme. This was the least-answered question because most people don’t have to use hooks or have no idea what they are. It’s more of a developer feature (though not limited to developers). The question was:

What new hooks (filter hooks and action hooks) need to be implemented within the theme? Where? Why?

In this post, I’ll run through some of the answers and give my reply.

Include options for hooks in the admin panel

This is not a bad idea at all. I wonder why I didn’t think of that.

Seriously, there’s already two plugins that do this — Hybrid Hook and Hybrid Hook Widgets. The former gives you admin screen with tons of options. The latter adds widget areas to several select action hooks. I encourage you to give them a try.

I don’t like the idea of this as part of the core theme though. Hybrid is meant to be a lightweight framework, which should be extended through things such as plugin and child themes. It’s not supposed to be a powerhouse, all-in-one package.

I’d like to see a “inside content hook”

WordPress already has one for you. It’s the_content and is used by many, many plugins and themes.

More comment area hooks

I definitely agree that the comments template and functions related to it need more hooks, especially filter hooks. In fact, it’s one of the first things I brought up in the Hybrid 0.7 discussion thread.

I could really use some more feedback on what hooks you want to see here. Feel free to post your ideas in the comments or the 0.7 discussion thread.

A visual overview of the hooks

This probably belongs under the documentation question, but it’s definitely something we need. I’m currently working on this and will be adding it to the hooks documentation as soon as possible.

I have no idea what this means.

This is definitely my favorite answer. Hooks are a way for you to add custom content to WordPress, the Hybrid theme, and some plugins without touching the core code. This allows you to easily keep up with upgrades without losing your customizations.

The truth is that not everyone needs to know how to use the WordPress hook system. It’s mainly for developers. But, if you really want to learn a little and customize your blog to your heart’s content, you need to learn the basics. Hooks, especially action hooks, are simple to use.

Here’s some resources for using the action and filter hooks in Hybrid:

Your thoughts

Even though the survey is now over, feel free to leave additional comments about action and filter hooks you’d like to see. I’m always open to suggestions.

Stay tuned for the next post on the survey results. I’ll be covering what you all consider “flaws” in the current Hybrid theme.

11 Comments


  1. On topic of figuring out hooks, I had quite a bit of trouble at start with Hybrid (didn’t know much about hooks overall) and made function to show what is hooked to what. It made into wprecipes, catswhocode and smashingmagazine posts by now. Seems many find it convenient to see list of wth is going on inside hook. ๐Ÿ™‚

    http://www.wprecipes.com/list-all-hooked-wordpress-functions

    Latest version is better at filtering so I usually set it to show hooks that start with hybrid and output at the bottom of page.

    Thinking about making widget out of it for debug purposes.

  2. Sam

    A is_sidebar_active filter allowing a child theme or plugin to activate or deactivate sidebars independently of the widgets inside them would be very useful.

    Thank you for your work on this terrific theme.


    1. WordPress already has like three different hooks for disabling widget areas. This is a topic that’s been covered several times in the support forums.

  3. Sam

    Is there a way to activate a Thematic sidebar (widget area) even if itโ€™s currently empty of widgets?

    I was trying to add a menu to the sidebar via the hybrid_before_primary hook, but I realized the hook action isn’t actually called unless there are widgets there already.

    I guess I can write my own widget instead, if that’s the way to do it.


  4. Not sure if this is the right place to ask this…
    I noticed the notification system on themehybrid.com. I was wondering if that’s already part of Hybrid Framework, where can it be enabled/disabled from and what would be the right way to do it.

    If it’s not, I’m sure there’s a lot of people who would cheer it’s implementation.

      1. In reply to Justin Tadlock

        I was asking about the subscription system.
        I might be wrong, but I don’t think it comes with WordPress.
        So I suppose it’s either a plug-in or a set of functions you made (that could be plug-in-able)…

  5. sam

    Could you add a hook to control the showing of the comments template?

    You could either convert the comments_template() call to a default Hybrid action that could be moved or removed, or you could call it with a boolean filter like

    apply_filters( 'hybrid_show_comments', true ) and comments_template( '', true );

    to allow toggling it.

    It would help publishers who don’t use comments at all save a few database queries.


    1. There’s already a WordPress hook for that. Plus, there’s no need because the database isn’t called if there are no comments.

  6. sam

    I don’t see any WP hook to remove or cancel the `comments_template()` function call.

    `comments_template()` will always query the database for comments if it’s called during a single post/Page request — you can check with var_dump or SAVEQUERIES — it just won’t include the comments template file if it finds zero comments.

Comments are closed.