Entries Tagged: droppin’ knowledge on WordPress
Smarter Hooks: Contextual Hooks
The article has been updated with a working example on how I’ve implemented the atomic hook approach in WP Framework. It’s also WordPress 2.9 compatible for custom post types and taxonomies. In the last article, we looked at a simple way for making your template files more cleaner and DRY using do_atomic(), a function that registers ... Read More
Smarter Hooks
Now that everyone’s finally understanding the benefits of using theme frameworks and the like, I’m noticing a lot more hooks in themes: theme_before_location(); theme_location(); theme_after_location(); Where location is the location of that particular hook (e.g. header, footer, loop). Now that’s great and all, but here’s a smarter way: do_atomic( ‘location’ ); Where do_atomic is: // Registers three action hooks at once. function do_atomic( ... Read More
Does your theme have children?
When working with WordPress theme frameworks or any parent theme, sometimes you might want to figure out whether a child theme is active or not. Here’s a quick function that’ll do exactly that: function has_kids() { if (STYLESHEETPATH !== TEMPLATEPATH) return true; return false; } if ( has_kids() ) { // do stuff } This function works whether you call it from a ... Read More
Droppin’ knowledge on WordPress: How to preset widgets to widget areas
I thought this would be the perfect time to introduce a new type of post I’ll be writing here at ptahd.com. Droppin’ knowledge on WordPress. Tips, tricks and lessons learned using WordPress. Everyone needs knowledge dropped on them about WordPress. Here, I’ll break it down so everybody’s in the loop! So, how do you preset widgets ... Read More