i would like to add a class to my html (.complete) with php:
if( get_field(\'to-do-repeater\') ) { Add (complete) class to 相关标签:
<?php echo "<div class=\"to-do to-do-wrap "; if(get_field('to-do-repeater')) { echo "complete"; } echo " \"></div>"; ?>
Try this code :
<div class="to-do to-do-wrap<?php echo get_field('to-do-repeater') ? ' complete' : '' ?>"></div>