There are two ways to approach this: modify the existing the_tags
function or build your own.
the_tags
ultimately relies on get_the_term_list
, which returns a list of hyperlinked tags. You would have to use regular expressions to add classes and styles to that using a filter. That would be quite cumbersome.
So, my preferred approach would be to construct a function yourself. Start with an array of tags and loop through them:
$all_tags = wp_get_post_tags (get_the_ID(), array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all'));
$output = "";
foreach ($all_tags as $tag) {
$tag_style = // get that from ACF
$tag_link = get_tag_link($tag->term_id);
$tag_name = $tag->name;
$output .= '<a class="tag-button w-button" href="' . $tag_link . '" style="' . $tag_style . '">' . $tag_name . '</a>';
}
echo $output;
Note: I didn't test this code, so some debuggin may be necessarry.