<?php
    $link = isset($pt['slug']) ? '/?s=' . urlencode($value) . '&pt=' . $pt['slug'] : '/?s=' . urlencode($value);
    if(isset($_GET['webien_pt']) && $_GET['webien_pt'] !== ''){
        $link .= '&webien_pt=' . urlencode(sanitize_text_field(wp_unslash($_GET['webien_pt'])));
    }

    $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>
