Home › Forums › Front-end Issues › Div Background color ACF › Reply To: Div Background color ACF
Hi,
What you would need to do would be something along the lines of:
<?php if(get_field('color')) {
$color = get_field('color'); ?>
<div class="title-item" style="background-color:<?php echo $color ?>;">
<?php } else { ?>
<div class="title-item">
<?php } ?>
<h4><?php the_title(); ?></h4>
</div>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.