Frameworks, Child Themes, Filters, and Hooks?

19 Comments

Ian Stewart has been hard at work experimenting with WordPress – first with the Thematic framework, and now with some awesome child themes. He’s also played with custom hooks and filters, and now includes some pretty helpful ones with Thematic. Confused? You probably are. Let’s get down on a more basic level and learn what Ian is doing, and then you’ll see why his latest work has been so influential.

Theme Frameworks

For those of you that have never heard of a framework, it’s a piece of software – or in this case, a WordPress theme – that includes many extra functions that you can use when developing a theme. For example, jQuery – a popular JavaScript library – uses JavaScript, but it automates many complex tasks by providing you with a simple function to accomplish them.

In many ways, Thematic is built in the same way. It’s a WordPress theme, and can be used right out of the box if you want. But it can do so much more. Using additional filters and actions provided by Thematic, you can extend your site even further by using this theme.

Child Themes

Fact of the day: Thematic is a theme. But it’s a parent theme. To understand this concept, let’s think of a regular WordPress theme, and how it works with WordPress. Think of WordPress as the parent theme, and your regular theme as the child. WordPress provides all sorts of useful functions to get data, from permalinks and titles to a list of categories and a tag cloud. Themes can utilize these functions to call data and organize it on the page.

Child themes with Thematic work exactly the same way. In addition to using the built-in functions provided by WordPress, they can use the extra hooks, actions, and filters that Thematic provides. They can also take advantage of the other great features Ian has built into Thematic, such as search engine optimization, grids based on the 960px grid system, CSS resets and frameworks, and 13 different widget-ready areas – just to name a few.

Filters

Let’s say you want to control how your post title is displayed depending on what page it is on. Normally you’d have one title in 404.php, another in archive.php, which is usually the same as index.php, but a different format than page.php, and so on. With Thematic’s built-in filters, you can control all of these titles from one file. Use conditionals to determine which format is to be used, and call the entire title set via a function in any of your theme’s files. It’s that easy. Visit Ian’s blog to see the code for this example.

Hooks

Hooks have the same function as wp_head() and wp_footer(). You can put them anywhere in your theme, and other files and plugins can add content to that area. For instance, wp_head() (which is built into WordPress) is often used by plugins to add JavaScript and CSS links to the header. There are two custom hooks in Thematic 0.6: thematic_belowheader() and thematic_abovefooter().

//hook into the area below the header
function childtheme_helloworld() { ?>
	 

Hello World!

Using this code,

Hello World!

will be inserted just below the header. If enough hooks are provided in the future, this could completely eliminate the need to manually place functions into your theme to include information from plugins, such as pagination and breadcrumb links.

Future Plans

Thematic development certainly isn’t done yet. Ian has a list of changes he’s considering for version 0.7, including more hooks, stylesheet organization, and completely merging Sandbox with Thematic completely.

Conclusion

Hopefully by now you have a better understanding of what all the Thematic hype is about. Ian is certainly doing some awesome stuff, and I can’t wait to see what else gets thrown into Thematic in the future. What else would you like to see Thematic do? Sound off in the comments.

Additional Links

19 thoughts on “Frameworks, Child Themes, Filters, and Hooks?

  1. Hi Dan, excellent intro & overview of child themes. I just found Ian’s site last week and started playing around with Thematic. The possibilities are endless and for people like me who are more design oriented than code oriented, this makes life a whole lot easier.

  2. Thanks for posting this on WpVote! I really enjoyed reading your article. Parents/children themes seems very interesting, I must learn more on that subject!

  3. Pingback: Tuesday News Stuff | Bernskiold Media

  4. I don’t know why people talk more about Semiologic Pro more. It was also the first Premium theme too, wasn’t it, Denis?

    Semiologic Pro has a built in layout switcher and skin switcher too, right? (Not something I’d be interested in for Thematic.)

  5. I don’t know why people talk more about Semiologic Pro more

    Should be, “I don’t know why people don’t talk about Semiologic Pro more.” As in, “because it has a lot of cool features.”

  6. Pingback: WordPress Theme Frameworks: A Designer’s Dream | Pat Dryburgh

  7. Pingback: BlogBuzz August 30, 2008 | Webmaster-Source

  8. Pingback: Why I created a WordPress theme framework

  9. Pingback: Parent/Child Themes in WordPress: The Future of WordPress Themes « Lorelle on WordPress

  10. Pingback: Build WordPress Sites Fast With the Thematic Theme Framework | Es Developed - Fresh Website and Graphic Design

  11. Pingback: Parent/Child Themes in WordPress: The Future of WordPress Themes « Lorelle on WordPress | digidisaster.de

  12. Pingback:   WordPress Theme Framework by Fishcakes Blog

  13. Pingback: Understanding Action Hooks In Wordpress « WordPress Theme Mods

  14. Pingback: Developing with Child Themes « 1001 Weblogs

  15. Pingback: Child 테마를 만들기 위한 최소 구성 요소

Leave a Reply

Please note that WPCandy is a moderated community.

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>