I'm working on a posts template for Oxygen and trying to output a list of tags for the current post.
The goal is to change the background colour of each tag by using the colour field post_tag_color
that I have added to my posts->tags taxonomy with Metabox.
This code (inside Oxygen's code block) only returns `style="background-color:;". when i'm looking at the html markup. The rwmb_meta doesn't output anything.
<?php
$post_tags = get_the_tags();
$background_color = rwmb_meta( 'post_tag_color' );
if ( $post_tags ) {
foreach($post_tags as $tag) {
echo "<span class=\"post-tags post-tags-id-$tag->term_id\" style=\"background-color:$background_color;\">$tag->name</span></style>";
}
}
?>
What am I doing wrong?