Displaying Region on Front End + Refreshing Permalinks

Hello,

Two questions!

[1]
I got the regions pages to work but it’s only working for newly added listings. I refreshed the permalinks (or thought I did. Maybe I’m doing that wrong?) for existing listings, but they aren’t getting added to the Regions pages. I also tried going to existing listings one by one and resaving the address, but they don’t get added to the Regions pages.

[2]
Other question I have, is how do I go about displaying these regions on the home page in the same way that Listings Categories are being displayed?

Thank you!

Hi Rachelle,
try this snippet but once you add it, please refresh the home page until all the regions are created, then delete this snippet (otherwise it’ll slow down the site):

add_action(
	'template_redirect',
	function() {
		if(hivepress()->get_version('geolocation')){
			$listing_ids = HivePress\Models\Listing::query()->order('random')->limit(50)->get_ids();
			foreach ($listing_ids as $listing_id){
				do_action( 'hivepress/v1/models/listing/update_longitude', $listing_id );	
			}	
		}
	},
	1000
);

Federico

1 Like

Please try the code snippet suggested above to generate regions for existing listings. Unfortunately, there’s no easy way to add the same block as for Categories, but this feature is on the roadmap.

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