Why I Choose The Genesis Theme Framework

A while back I wrote about WordPress Theme Frameworks and whether you had taken a look at them yet. Today I’d love to share with you why I have used the Genesis Framework by StudioPress the last couple of months..

In my previous post on the topic I discussed the pros and cons and came to this conclusion:

For me personally, I’m all about options. I love working with a WordPress Theme Framework that allows me to have a very high level of control over how specific I want to be in what I want my theme to output. I don’t mind the learning, in fact I love learning, and when you know your way around the forums you’ll be able to either find what you were looking for or get a working answer of your fellow developers. Plus, having a Parent Theme that is continuously updated is big plus for me.

So even though you could argue a framework is bloat and adds a lot of stuff that you perhaps won’t ever need, to me that’s irrelevant because you only load what is needed and I could care less about how much kB the themes take up on the server.
[Read more…]

Conditional Logic and Filters for the Genesis Framework

WordPress CodeOn a recent project using a Genesis child theme I found myself in a situation where I wanted to use a filter, but only on certain views, namely the category view and the homepage view. Adding a filter is pretty straight forward, but using that filter in combination with conditional tags you need to add a bit extra instead of just the tags themselves.

Now, the example is for the Genesis Framework, but really the logic behind will work on any child theme using filters. What I wanted to filter was the output of the post meta area, which normally displays both the categories and the tags. I wanted to use a slightly different post meta on the homepage where the tags would be replaced with a Continue reading link.

This is what the filter looks like:

[php]//Customizing Post Meta
function forsite_post_meta_filter($post_meta) {
$post_meta = ‘[post_ categories], <a href="’. get_permalink() .’" title="’. the_title_attribute(‘echo=0′) .’">Continue Reading</a>';
return $post_meta;
}[/php]

As you can see I am just adding a permalink with a ‘Continue Reading’ text. Nothing too fancy. Normally you would add your filter and you’d be all done. Like so:

[php]//Customizing Post Meta
function forsite_post_meta_filter($post_meta) {
$post_meta = ‘[post_ categories], <a href="’. get_permalink() .’" title="’. the_title_attribute(‘echo=0′) .’">Continue Reading</a>';
return $post_meta;
}

add_filter(‘genesis_post_meta’, ‘forsite_post_meta_filter’);[/php]

Using Conditial Tags with this filter actually requires the use of an add_action statement. The way to do is by declaring another function which handles the conditional tags. Something like this

[php]function forsite_post_meta_conditionals() {
if( is_home() || is_category() ) {
add_filter(‘genesis_post_meta’, ‘forsite_post_meta_filter’);
}
}

add_action(‘wp’, ‘forsite_post_meta_conditionals’);[/php]

The if statement determines to actually use this filter only whether you are looking at the home page or the category view. Combined the full code looks like this:

[php]//Customizing Post Meta
function forsite_post_meta_filter($post_meta) {
$post_meta = ‘[post_ categories], <a href="’. get_permalink() .’" title="’. the_title_attribute(‘echo=0′) .’">Continue Reading</a>';
return $post_meta;
}
function forsite_post_meta_conditionals() {
if( is_home() || is_category() ) {
add_filter(‘genesis_post_meta’, ‘forsite_post_meta_filter’);
}
}
add_action(‘wp’, ‘forsite_post_meta_conditionals’);[/php]

On all occasions where I used post_categories in these code snippets I’ve added an extra blank space between the underscore and categories for it otherwise shows the actual content. So when implementing this code, be sure to delete that extra space!

More info on conditional tags can be found in the Codex, and more information on WordPress filters. Have you worked with conditional tags and / or filters before?

This article first appeared on Devlounge.

WordPress Frameworks, Have You Taken a Closer Look Yet?

StudioPressI’ve been working a lot with WordPress Theme Frameworks lately, most notably Genesis, Thematic and Hybrid, when developing themes. Well, child themes really. There are many reasons why working with child themes is a good way to start developing, but there are also some drawbacks. For me the good weighs out the bad in general, but there are situations where the old straight forward theme development method is just plain faster.

The Good

Building with child themes has a lot of powerful advantages. My favorite are:

  • Development Speed: Having an already working theme as a parent theme, a theme that already has been looked at from a lot of different angels as to what it should be able to do, and already some basic styling in place makes it a lot easier to quickly make some changes via the child theme style sheet.
  • [Read more…]