[wp-hackers] get_theme_support( 'post-formats' )

Otto otto at ottodestruct.com
Wed Jan 12 15:34:10 UTC 2011


On Wed, Jan 12, 2011 at 8:57 AM, Chip Bennett <chip at chipbennett.net> wrote:
> $my_theme_supports = get_theme_support( 'post-formats' );
> ...should result in, e.g.
> $my_theme_supports = array( 'aside', 'gallery' );

Actually, it returns an array with an array in it.

array(1) { [0]=> array(9) {
[0]=> string(5) "aside" [1]=> string(5) "audio" ...
} }

So you'll want to reference it with the [0].

Simple code:
$my_theme_supports = get_theme_support( 'post-formats' );
if (is_array($my_theme_supports)) $my_theme_supports = $my_theme_supports[0];

Now you'll have what you expect it to be.

-Otto


More information about the wp-hackers mailing list