[wp-hackers] post format types

Otto otto at ottodestruct.com
Thu Jan 6 20:01:24 UTC 2011


On Thu, Jan 6, 2011 at 12:45 PM, Philip M. Hofer (Frumph)
<philip at frumph.net> wrote:
> I disagree, if the fallback of post_format_exists brought it to standard or
> empty on non-designed themes with it.  The first thought I had when I heard
> about this was "cool, I can have each author have their own "post look""
> that they can set.

You already had that. The get_the_author_meta( 'login' ) function will
get the author's login name just fine, and you can use that in much
the same way as you use get_post_format(), to change things based on
author.

Heck, you can even make a minor change to the post_class to make it styleable:

function post_class_author($classes) {
$author = get_the_author_meta( 'login' );
$classes[] = "author-$author";
return $classes;
}
add_filter('post_class','post_class_author');

Voila. Now you get an "author-foo" or similar in the post_class()
output, and you can style posts from individual authors by simply
using .author-foo in the stylesheet. If you want to go further and add
a customizable stylesheet box for each author in the profile page, I
can show you how to do that too.

-Otto


More information about the wp-hackers mailing list