Reputation: 161
i would like to add a class to my html (.complete) with php:
if( get_field('to-do-repeater') )
{
Add (complete) class to <div class="to-do to-do-wrap"> should be <div class="to-do to-do-wrap complete">
}
else
{
Do nothing
}
Upvotes: 4
Views: 73657
Reputation: 1
Try this code: `
<div class="to-do to-do-wrap <?php if(get_field('to-do-repeater') echo "complete"?>">
Upvotes: 0
Reputation: 7749
Try this code :
<div class="to-do to-do-wrap<?php echo get_field('to-do-repeater') ? ' complete' : '' ?>"></div>
Upvotes: 8
Reputation: 1518
<?php
echo "<div class=\"to-do to-do-wrap ";
if(get_field('to-do-repeater'))
{
echo "complete";
}
echo " \"></div>";
?>
Upvotes: 3