Support

Account

Home Forums Front-end Issues Added classes does not show

Solving

Added classes does not show

  • I’ve used wordpress with divi builder and acf pro to create a website with around 100 projects.
    Now i want to add a class to some of the content, because i need to style it different than first intended. The newly added classes does not show up in the html and i can not style them in the css, only the ones that shows are the ones added in the beginning before i made the 100 projects.

    Is there something that i’m missing, or is it not possible?

  • Going to need some more information, it’s not clear what the issue is or what you are trying to do.

  • I have added the class sem_price after making all the posts, as I want to change the style of the price on all my posts. All posts are using different templates, so i’m not able to change all at once. That is why I want to add a class to them.
    I cant see the class and style them after i added it?

  • This class is only applied to the wrapper of the field in the admin. It has no effect on the front end of the site.

    There are 2 choices.

    1) You need to edit every template where you want to add this class.

    2) You can create an acf/format value filter for the field that adds a wrapper around the content of the field.

    
    add_filter('acf/format_value/name=your-field-name', 'add_content_wrap_to_your_field_name', 20), 3;
    function add_content_wrap_to_your_field_name($value, $post_id, $field) {
      $value = '<div class="your-wrap-class-here">'.$value.'</div>';
      return $value;
    }
    
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Added classes does not show’ is closed to new replies.