3 deleted 18 characters in body
source | link

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_field("tag_color",// $tag->term_id);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.

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_field("tag_color", $tag->term_id);
  $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.

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.

2 debugging array to object
source | link

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 = // retrieve from ACF based onget_field("tag_color", $tag['slug']$tag->term_id);
  $tag_link  =  get_tag_link($tag[term_id]$tag->term_id);
  $tag_name  = $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.

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 = // retrieve from ACF based on $tag['slug']
  $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.

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_field("tag_color", $tag->term_id);
  $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.

1
source | link

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 = // retrieve from ACF based on $tag['slug']
  $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.