I can use post_class()
to echo all classes for a post. How can I output only the category-ID
as a class, and how can I include this while using heredoc string syntax
?
I got this function in which I would like to use post_class()
, and I have tried get_post_class()
which does not work, because its an array to string conversion.
function imageHolder($ID) {
$classes = get_post_class($ID, 'image-holder');
return <<<HTML
<div $classes></div>
HTML;
}
echo imageHolder(2);