Home Forums General Issues Add Field Values to WordPress post_class Reply To: Add Field Values to WordPress post_class

  • 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 🙂