For your filter to work, the Hybrid Core code would have to run something like $abcd = apply_filters('hybrid_post_attributes',$something);
and I don’t see that in the code you posted. In fact, I don’t see apply_filters
anywhere at all. Based entirely on that posted code, you can’t filter those items.
I don’t think you understand how filters work. You cannot hook to a function. You need to hook to something specifically created with apply_filters
or do_action
(for action hooks). See:
Clarification on filters and hooks
http://codex.wordpress.org/Plugin_API
However, my guess, based on the name, is that hybrid_get_post_class
is itself hooked to post_class
. You should be able to hook your own function to that.
add_filter('post_class', 'my_post_attributes');
function my_post_attributes($classes){
$classes[] = ' item';
return $classes;
}
Here is your “one line” version, @ChipBennett.
add_filter('post_class', 'my_post_attributes');
function my_post_attributes($classes){
return array_merge($classes,array('item'));
}