Home › Forums › General Issues › Add Field Values to WordPress post_class › Reply To: Add Field Values to WordPress post_class
Awesome, thank you so much! Think that finally did it. I ended up using concatenation to add more classes.
It ended up looking like this:
<?php $bgcolor = get_field('baggrundsfarve'); ?> <?php $customclasses = $bgcolor . " " . get_field('justering'); ?> <article id=”post-<?php the_ID(); ?>” <?php post_class('et_pb_post clearfix ' . $no_thumb_class . $overlay_class . $customclasses) ?>>
Out of curiousity, is that the proper way to add a space between the two classes? I mean it works just fine, but I feel like it’s a bit of a MacGyver solution.
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.