dimanche 10 septembre 2017

how to add css class in php if/else statement?

I wrote this code to add css class to a post title. it works in wordpress. I think it is correct code but not working

<h2><a  <?php if(get_post_meta(get_the_ID(),'hot',true) == 'on') { ?>class="hottitle" <?php } ?> title="<?php the_title_attribute(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

but it dont work. please help me

Aucun commentaire:

Enregistrer un commentaire