I am trying to remove ‘%20’ from my filter tag URL’s as my code to add ‘active’ class isn’t working for tags with spaces
I have tried the below but none have worked
str_replace("%20", "-", $tag)
decode($tag)
rawdecode($tag)
My code:
<?php $tags = $page->children()->listed()->pluck('servicecategory', ',', true); ?>
<a class="p" href="<?= $page->url() ?>">all, </a>
<span class="tag-links">
<?php foreach($tags as $tag): ?>
<a class="p tag <?= param('category') == $tag ? "active-tag" : '' ?>" href="/work/category:<?php echo str_replace("%20", "-", $tag); ?>">
<span class=""><?= $tag ?></span>
</a>
<?php endforeach ?>