It’s been quite a few months since the last major version update of the Hybrid theme framework. I consider this a good thing because it means that the 0.6 branch has been extremely stable.
I know some of you are also awaiting the new features that come along with new versions, so I’ll lay out what’s in store.
Hybrid “core” framework
Some people seem to think that parent themes like Hybrid are not true frameworks. Well, when it comes to Hybrid, this is not entirely true.
There is a major difference between the Hybrid Framework and the Hybrid Theme. You just don’t hear me talk about it much because I’m fairly certain the majority of Hybrid users aren’t developers and don’t want to code their own themes.
So, I want to set the record straight a bit:
- The Hybrid theme is a parent theme (most of you use this), which includes the Hybrid Framework. You use child themes to customize this to your liking.
- The Hybrid Framework is everything within the
/hybrid/librarydirectory of the theme. It is a complete development framework used for creating themes (not child themes).
Does this mean anything to the majority of you? Absolutely not.
The only person that has had to worry about the framework is me. But, I’ve been working overtime on making the framework ready as a separate release for hardcore theme developers. If you don’t fall under this category, disregard everything here. If you are a hardcore developer, I’ll be writing a post detailing everything about the framework in the near future.
I’m putting this under the 0.7 features because I’ll be releasing this version of the framework just after the theme release.
Context-aware hooks and classes
Many of you are aware of Hybrid’s slew of <body> classes, which have been around from the start. These are getting a complete makeover to be more uniform and understandable. The idea for this actually came around when I decided to add contextual hooks.
What the heck is a contextual hook?
For those of you adding custom actions and filters, your lives will get much easier. For example, if you wanted to add an image before the content on the home (front) page, you’d normally have to write all of the logic into the code yourself using the is_front_page() conditional tag. Well, the logic’s being taken care of by the theme. Let’s look at what this code will now look like:
add_action( 'hybrid_home_before_content', 'your_function_name' );
function your_function_name() {
/* Image code. */
}
There’ll be several contexts per page, creating a cascading effect. For example, that same hook on a single post with the ID of 100 would create four different hooks:
hybrid_before_content
hybrid_singular_before_content
hybrid_singular-post_before_content
hybrid_singular-post-100_before_content
So, you can latch your custom functions pretty much anywhere and write less code.
Taxonomy templates
In 0.7, all taxonomy templates will follow the same hierarchy. In WordPress, the post tag (tag.php) and category (category.php) templates follow different rules, but I don’t much like how they’re handled. Now, all taxonomy templates will follow this hierarchy:
taxonomy-$taxomy_name-$term_slug.php
taxonomy-$taxonomy_name.php
taxonomy.php
Comment templates
Another major change is that individual comment types will have their own templates. For example, regular comments will use the comment.php template while pingbacks will use the pingback.php template.
This is a major feature for those of you using things such as custom comment types. For example, you could create a file called tweetback.php to handle tweetbacks.
The comment form itself is also getting its own template called comment-form.php.
Removal of templates
The log-in.php, profile.php, and register.php templates are being removed from the theme. If you use those templates and want to keep them, please transfer them to your child theme folder at this time.
The reason I’m doing this is because the theme is not equipped to work alongside plugins that extend these things in WordPress. There are specific hooks and functions that need to be running for these to work as great as I’d like them, so I’ve decided to leave things that WordPress does great alone.
Plus, there’s plenty of plugins that will allow you to change these pages in WordPress.
Theme settings page changes
The theme settings page is getting a complete overhaul.
The first of these changes is the ability to filter out who can see the settings page. Normally, anyone with the edit_themes capability could change the settings. But, you’ll be able to filter this out and assign a specific capability through a plugin such as Members.
More credit will be given to child theme authors. The new settings page will set a footer link back to the child theme page by default. There’ll also be a link to the child theme page and description of the child theme in the “About” section of the theme settings page.
Take a look at a preview of the redesigned theme settings page. It’s quite different than before, which brings me to the third major change…
Removal of Hybrid’s SEO settings
Whether the theme or a plugin should handle SEO stuff (i.e., meta, indexing) has been a hot topic of debate. I’ve even brought it up for discussion and allowed you all to vote on the issue.
Basically, there’s been no clear decision as both sides of the debate have valid points and roughly the same number of people.
So, I decided to go with the most important factor — keeping the framework as lightweight as possible. Hybrid is meant to be extended (and, ideally, wouldn’t have an options page at all), so I’ll be coding a separate plugin for this. The current name for it is Hybrid Meta, but I’m open to alternate naming suggestions.
Don’t fret though. If you like the way Hybrid’s SEO features are set up by default and the individual post/page settings, those things will still be around. The only thing really being removed is the ability to set this stuff on the theme settings page. And, an option to turn the features on/off will be added. This way, you can decide for yourself what SEO plugin to use.
Escaping and security
I hesitate to use the word “security” here because I don’t want to cause a scare, but I do consider some of the upcoming changes to be making your site more secure on the theme side. Don’t worry though; as far as I know, there are no known security exploits at work.
Mostly, what I’ve been doing is making sure anything that’s not completely hardcoded within the files is properly escaped. An example of this would be a commenter adding some weird code in the website field. Even though WordPress does a great job at making sure nothing odd gets through, I think it’s important to be certain that things like this are escaped.
The extra escaping I’m doing includes making sure translations don’t mess something up and even trying to make sure child theme developers don’t slip up when filtering something.
Many of these changes will actually be in Hybrid 0.6.2 (should be released within a week).
And more changes
Honestly, I’m getting tired of detailing all of the changes. There’s just so many that I think I’ll save some for later. When I look at the code for version 0.6.1 and the code for 0.7, it’s like I’m looking at two different themes. Everything looks and feels the same, but under the hood, it’s a different beast entirely.
My main goal with any release is to make everything more efficient, and I’ll definitely be able to check off that goal when 0.7 is out.
Hybrid 0.7 will be released a few days after WordPress 2.9 (due out sometime in December), so there’s still a little time for me to work on the code. If you have ideas or suggestions for this particular release, don’t hold back now. Let me know what you think.
Also, feel free to hop into the 0.7 discussion topic (90+ posts and counting) in the community forums, which is open to all members.
Very cool stuff! I particularly like your idea of adding template specific hooks.
Do you think there is any risk that adding so many hooks and checks in could start to slow down the system? Or would the difference in performance be imperceptible?
There’s minimal change. That’s one thing I’ve looked at closely, but things seem okay. Plus, action hooks should be getting a performance boost.
I’ve also coded one major function that runs pretty much all the dynamic/contextual stuff and store everything in a global variable once per page view.
This is some great progress. I’m looking forward to checking it out.
Awesome, can’t wait for the new changes. The new hooks and filters sounds like it will be easier to create a better more lightweight child theme.
I’ll be sure create something cool when 0.7 comes out..
I’m schizto about the SEO and need four or more hands. I think, all told, I understand and am fine with it (also, at this point, I’d have to do several rude things to screw up my SEO ranking so … right). Understood
Hey Justin. All sound like good moves. I’ll look forward to checking out how you code the theme options- I’d like to see some more robust and extensible frameworks for this.
Also, I think separating the SEO functions is a great idea. Mullenweg said (at WordCamp Portland) that the strength of the WordPress platform has really been that it is a lightweight base with the opportunity to plug-in any non-essential features as needed. I think theme developers should ascribe to this philosophy as well.
Justin, the Hybrid framework sounds great!
I know I’ll be interested!
I also think that separating the meta data SEO info out from the framework was a good decision (after all, it does sound like something a plugin should handle).
hi justin,
Any idea when version 0.7 gonna be out? It would be great if it goes public before end of November.
Good to have so many features in store. I absolutely agree with separating any unwanted features and focusing on speed, especially SEO tags.
Regards
TJ
It won’t be out until a few days after WordPress 2.9. Hybrid 0.7 won’t support WordPress 2.8 because it uses some of the new features. So, mostly we’re just stuck waiting.
Once WordPress 2.9 is released, I’ll do some final testing, load it on my blog to be sure it works, then release it.
Do contextual hooks support using identifiers (e.g. slug; names; category name; etc.) other than ID?
In your example, you have:
hybrid_singular-post-100_before_contentWould any of these work:
1)
hybrid_singular-post-10-Top-Movies-of-'09_before_content(title)2)
hybrid_category-100_before_content(cat_ID)3)
hybrid_category-drama_before_content(slug)I suspect that #1 and #3 will NOT be supported. Thanks in advance.
I’ll be writing a tutorial on everything that’s possible soon. Slugs will be used for most things, but I’m thinking IDs would be better for singular entries because that could become troublesome with slugs.
[...] Framework I read the following blog post by Justin Tadlock a few days ago: http://themehybrid.com/archives/2009…for-hybrid-0-7 I always thought the Hybrid theme was the framework, but I guess not. When I was commenting on the [...]
hi Justin! Good news about hybrid 0.7, I like all of them.
Are you going to make a bbpress theme that integrates with hybrid?
Definitely looking forward to your post about separating out the theme from the framework. After looking through the directory structure at
http://themehybrid.com/themes/hybrid/directory-structure, I’m understanding better the separation of form and function.
I think I will be one of those developers who will want to separate the framework and make modifications to php files outside of the library folder. I also tend to clean out files I’m not using just to make things easier to find. Obviously, I need to understand how upgrades will work and how to take what is needed from the theme and add it to my modified theme and leave other stuff behind.
I tend to agree with Ian that the term “framework” has been co-opted and means “parent” to too many people and has caused confusion as some of us read you, Ptah and Ian. As I look to combine the Hybrid Framework and the Buddypress Framework, clearing this confusion will be most helpful.
I have been busy, so I have not had a chance to look through this with some rigour.
When working on a child there for hybrid – I was wishing at times that I could modify the generated div/class structure – in some sort of supported manner. The hierarchial relationship with respect to the stylesheets is something less than well-structured and intuitive -if one’s center of gravity is somewhat closer to designer than developer.
The broad strokes seem to be headed in a direction that hasn’t triggered any immediate concern – but, as they say, the devil is in the details. Creating a strong line of demaraction between the framework and everything else seems, if anything, slightly overdue – if the objective has been to have an intermediate class of users “in the club” write and publish child themes – that can minimally mimic the very best of what is already being done in terms of layout and design elsewhere.
There are far too many “themes” that break no new ground – so there has to be an eye toward what’s preventing designers from adopting Hybrid as the platform of preference.
On my end of the rainbow, I now have a Hybrid-based fluid child-theme – but it wasn’t without an awful amount of work and experimentation – in areas that I would have preferred to not tread – such as “sticky footers” and the like – and having to crawl-up into the generated code a bit further than I would have wanted.
Nothwithstanding my remarks herein, Hybrid is really the only thing out there that is even trying to address the structural issues – in a manner that creates a reasonable synergy between programming and design disciplines – So I remain encouraged – and I take my hat off to Justin for all of his continued hard work.
As things stand – I will both stay-tuned, and renew my membership here.
I think one of the things that keeps Hybrid moving forward while other themes don’t “break [any] new ground” is that I personally use it for all my projects. Not only do I get feedback from you all, I’m testing it in real-world scenarios every day. So, if something can’t be done, I’m going to try my best to add that functionality in.
Hello,
what about full width header/footer option? It would be great if I can choose what kind of header/footer I would like to have.
Yep, this is definitely already possible.