Shortcode to display Map Block?

We’re developing landing pages outside of HP’s own system. We want to use the map block, but first off, it seems to only be available to use in HP’s templates. So we’re looking to see if there’s a shortcode designed to display a map instead. I’ve tried things like [hivepress_map] or [hivepress_listings_map] but they don’t seem to work.

Yes, this is a template-specific block because it requires the listing query context (it displays the map markers of the currently queried listings). If you’re creating templates in HivePress/Templates please try the [hivepress_listing_map] or just the Map block from the Template block category.

So how can you display the map in a custom post type or a page? Using a shortcode, a hook or a raw code at least. We can’t find any documentation on this topic.

This requires customizations, you can try this snippet:

	function ( $meta ) {
		$meta['label'] = 'Listing Map';

		return $meta;

It will make the map block available in Gutenberg, and the [hivepress_listing_map] shortcode should start working, but this requires further customizations - this block should be in the “listing query” context to display markers (this context is available on the listing page, and the listing search pages).

1 Like

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