Route to listings page for single attribute

Hi all,

I was wondering what is the proper way of directing router to a listings page with single attribute or possibly more attributes being selected.

My listing block shows attributes “City” and “Country” which has values such as London, United Kingdom.

image

When user clicks on the country, it should lead to listings page with all listings from that country.

I assumed that something like this may work but didn’t.

<a href="'.esc_url( hivepress()->router->get_url( 'listings_view_page', ['listing_country' => $country] ) ).'" class="hp-listing-block-country-link"><i class="hp-icon fas fa-map-marker country-icon"></i>&nbsp;&nbsp;'.$city.', '.$country.'</a>

I suppose that this is quite simple but I’m struggling with the right syntax.

Thanks a lot.

Resolved, but not through router.

Solution:

<a href="'.get_site_url().'/listing-country/'.$country.'" class="hp-listing-block-country-link"><i class="hp-icon fas fa-map-marker country-icon"></i>&nbsp;&nbsp;'.$city.', '.$country.'</a>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.