Conditional title for Map

Hi,
I am using Mapbox and I would like to show a title and a warning text above the map only when markers are available, and only for Listings View Pages.
Indeed, as you know, your current map is displaying only partial results per results page and this is misleading for the readers.
How can I manage this, please ?
Thank you for your help.

Hi,

If you mean adding text above the map, there are two possible options:

  1. Overwrite the Listing template using this doc: How to customize templates - HivePress Help Center.

  2. Create a custom PHP snippet to add the appropriate text to the sidebar: How to add custom code snippets - HivePress Help Center.

​I hope this is helpful to you.

Hi Andrii,
Thank you for your reply. But I put in bold some important words in my initial message because if you do a basic overwriting of the template, sometimes you will get pages with title but no maps, when all listings on a given page will not include any address.

So I would like to hide the title for this specific case…

The snippet could be something like :

if markers exist :
Display a title for the map;
else :
Hide the title;
endif;

How can I manage this snippet through ‘hivepress/v1/templates/listings_view_page’ filter, while I can not get any listings details (i.e hp_longitude, hp_latitude) with this filter ?

Thank you.

Hi,

Unfortunately, there is no easy solution here, as this feature will require a custom implementation. As a workaround, you can simply specify the title and notes to it, or add custom code. We can provide general recommendations if you are familiar with coding or have a developer.

I was afraid that it not would be easy. But thank you @Andrii for your time.
Do you think that this implementation could be integrated in your future versions ? This is the only way to draw readers attention to the partial results displayed on the map, due to the limitation of the number of markers/page.
Thank you.

1 Like

Hi,

Unfortunately, we have no plans to add such changes yet, but thanks for your suggestion, we’ll consider adding this feature.

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