I am trying to add a class name to an element using ACF but I cannot get it done… Please does anybody how to solve it?. Thank You!!!
<div class="<?php the_field('my_class_field'); ?>">
I tried it but it is not working… When I put the class name it doesn’t appear in class”This is empty – class name”
code here would be better, it is impossible to copy and paste text from an image
<i class="<?php the_field('home_icons', 5); ?>">
you are trying to get the values from the post ID of 5, not the current post or options. Whatever post ID 5 is probably does not have a value. Are you sure you want to specify a post ID here?
Even if I remove Post ID 5 is still the same the image doesn’t appear…
This is how it works – you put a class and the icon appear that what I am trying to get… :))
Please provide more information. Where is this value saved? Is it on a post or is it options? What kind of field is it? Is it a sub field of a repeater, group or flexible content field?
It is saved in a Post Category that’s why I put an ID
That information would have been helpful. You need to supply the correct value so ACF know where to get the value from https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/