Hiding Extra Field Placeholder Labels When Empty

15000+ live websites are using this google maps wordpress plugin.

How to hide labels when the extra field placeholder is empty?

Placeholders are used to display extra information about the location in the info-window. WP MAPS PRO allows you to create unlimited extra fields and display them in the info window.

Sometimes we have many placeholders according to different types of locations and we have the same info window to display all information so when we display this information on the map listing window and marker info window using placeholders we write it with the label and which is not related to some location or don’t have data its label is displaying in the location info window without information.

Problem :

Often we write placeholder like as in the below given example.

In this e.g, we are writing extra field like as:
Rating – {ratings}
Hours – {hours}
Website – {website}

You can see in the below given info window image how we wrote placeholders that are not displaying properly on the frontend.

Using the above method will display blank labels in the info window if the related placeholder value is not available. It will display a blank label when we don’t have related placeholder values.

Solution :

Please wrap up the placeholders label in <div> tag in the listing and location info window as shown in the below given image.

*  Please use placeholder labels to display extra fields like as given below in the example.
In this example, we are wrapping label and value in <div> tag like as:
<div><strong>Rating –</strong> {ratings}</div>
<div><strong>Hours –</strong> {hours}</div>
<div><strong>Website – </strong>{website}</div>

Hide Empty Labels in WP Maps Pro

Using the above method it will hide the labels from the info window if the related placeholder value is not available.

 

Was this article helpful?
YesNo

Install Plugin Now!

Buy this plugin exclusively on CodeCanyon! You’ll get free updates, full support, and if you’re not satisfied, we’ve got you covered with a 30-day money-back guarantee.