That’s what would have made sense to me too, but it just smacks them together without the added whitespace. Oh well, it’s not a big deal was just curious. It works as intended now, so that’s awesome!
Thanks again, and have a good weekend π
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.
Hey RemSEO, thanks for helping!
Incredibly that is what I end up getting to on my own as well, so I’m glad that I’m not totally lost. However I can’t get it to work fully. If I do as you mentioned it’ll look like this:
<article id="post-<?php the_ID(); ?>" <?php post_class('et_pb_post clearfix' . $no_thumb_class . $overlay_class . the_field('myfieldhere')); ?>>
It ends up putting the value infront of the class attribute on the site like this:
myfieldvalueclass="et_pb_post clearfix post-3326"
I cut out some of all the other classes in there, following post-3326, to keep the snippet short.
I can’t seem to get the value to be moved inside the class attribute, keeps ending up in front like that π
::: EDIT :::
And yes, thanks for the headsup as well by the way! I am working in a childtheme to avoid issues in the future π
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.