Custom category page with taxonomy filters

WordPress custom category page that filters from URL.

I have two taxonomies – offer and network

On custom category page load nothing appears. Even when I use OR or AND.

When I filter I sometime get the correct display.

I believe the problem is in the else statement. Can anyone see the problem? WHat am I doing wrong?

if (isset($_GET[‘offer’]) && !empty($_GET[‘offer’]))
{
$offer = $_GET[‘offer’];
}

else
{
**$offer = ”;**
}

if (isset($_GET[‘network’]) && !empty($_GET[‘network’]))
{
$network = $_GET[‘network’];
}
else
{
$network = ”;
}

‘tax_query’ => array(

‘relation’ => ‘OR’,

array(
‘taxonomy’ => ‘offer’,
‘field’ => ‘slug’,
‘terms’ => $offer,
‘operator’ => ‘IN’
),

array(
‘taxonomy’ => ‘network’,
‘field’ => ‘slug’,
‘terms’ => $network,
‘operator’ => ‘IN’
),

),

Read more here:: Custom category page with taxonomy filters

Leave a Reply

Your email address will not be published. Required fields are marked *