<?php
    $link = isset($pt['slug']) ? '/?s=' . urlencode($value) . '&pt=' . $pt['slug'] : '/?s=' . urlencode($value);
    $slug = isset($pt['slug']) ? $pt['slug'] : '';
    $title = $pt['title'];

    $amount = isset($pt['amount']) ? '<span class="count">('.$pt['amount'].')</span>' : '';
    $active = isset($_GET['pt']) && $_GET['pt'] === $slug ? ' active' : '';

    // Sets relevance as active on load
    if($slug === 'any' && !isset($_GET['pt'])){
        $active = ' active';
    }
?>

<a class="pt<?= $active ?>" href="<?= $link ?>" data-pt="<?= $slug ?>"><?= $title ?> <?= $amount ?></a>
