Adding post class to div with printf
-
I’m trying to add a post class to an opening div tag using printf, only it keeps on throwing an error. My code is as follows:
if( ! empty( $img ) ) {
printf( ‘<div’ <?php post_class(‘alignleft’); ?> ‘>’);
printf( ‘%s‘, get_permalink(), the_title_attribute( ‘echo=0’ ), $img );
echo ‘</div>’;I’ve been racking my brain on this and can’t figure out what I’m doing wrong? Maybe I just can’t insert a post class into a div this way?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Adding post class to div with printf’ is closed to new replies.