I'm completely open on how to do this:
I have the line:
echo implode(', ',get_field('categories'));
Which is outputting this:
Branding, Web, Print
I have 20 or so options it can output depending on what checkboxes were ticked.
At the moment, what it's outputting is just plain text. How can I make each tag a link? The link would need to be unique per tag so:
<a href="tags/design/branding">Branding</a>, <a href="tags/design/web">Web</a>, <a href="tags/marketing/print">print</a>
UPDATE: The first part of the question is working thanks to Brady. I now have an additional question -
Using Brady's answer on the line:
$elements = '<a href="/tags/design/' . strtolower($category) . '" title="' . $category . '">' . $category .'</a>';
If you look at the href it has the link /tags/design/, some of the tags it's outputting are using the correct link but some are from another section and the link should be /tags/marketing/. How can I account for this? (Not that I know how to do this, someone will need to show me!) Could I create an array with the tags "Branding, Web, Print" and if the $category variable matches this then give it the variable $design. Could I then create another array with "Advertising, Analysis, Campaign" and give it the variable $marketing if the $category matches that. Then in the link I could put href="/tags/$design/$category" or href="/tags/$marketing/$category"?
So a couple of examples would be (I'll put them as normal links):
From the design section:
<a href="/tags/design/branding">Branding</a> <a href="/tags/design/web">Web</a> <a href="/tags/design/print">Print</a>
From the marketing section:
<a href="/tags/marketing/advertising">Advertising</a> <a href="/tags/marketing/analysis">Analysis</a> <a href="/tags/marketing/campaign">Campaign</a>
There are only two sections design and marketing, within those sections there are several tags, if that makes sense. The sections in WP are setup like this:
tags > design > (each tag - branding, web, print is it's own page). tags > marketing > (each tag - advertising, analysis, campaign is it's own page).