BLACK FRIDAY 2017 - Click here to get a 40% discount on all downloads

With the release of GeoDirectory 1.6.6 brings some long awaited improvements to our custom fields settings. Most changes at first might just seem cosmetic with a new more modern user interface (UI) and tool tip hover boxes to explain what things do better but under the hood the entire system has been re-written for much greater flexibility for both users and developers.cf1

Show in what locations?

One of the requests we get quite often is “how can i add additional information to the map popup?” and with 1.6.6+ it is only one click away.  We have a new drop-down multi-select field to set where you would like to show the field: cf2

Now you can add any custom field to the map popup bubble as well as show fields in several different locations, these different locations shown above are the default ones but we have made it extremely easy for theme and plugin developers to be able to add their own locations to the list and and be able to output them with one line of code.

For developers:

In the past for developers to add a new field to our add listing form they were very limited, it was possible but they often could not take advantage of the drag & drop positioning of field or the price package limiting or even adding to our database to be able to sort by that specific new field, now all of that has changed and we have made it very easy for developers to be able to add their own custom fields and output them as they want and take full advantage of field positioning, sorting and output locations, you can now even output the fields in different formats depending on the location it is shown.

To show how easy it is we will use a simple example below, for this example we will collect a users twitter username and output their twitter feed.

Add the field to the custom field list:

There are two places you can place new fields, Predefined or Custom with the hooks ‘geodir_custom_fields_custom’ or ‘geodir_custom_fields_predefined’ respectively.
The function and hook below will add the field to the list of predefined fields.


Now the custom field will show in the predefined field list:
cfcp

Output the twitter feed:

By default now if a user enters their twitter username into the field it will just simply output the twitter username like so:
cr4

So in order to output a twitter feed we must add one more hook and function, this function takes over the output of the custom field by custom field key, in our example above you can see we made out custom field array key “twitter_feed” so the hook we will use will be ‘geodir_custom_field_output_text_key_twitter_feed‘. Field out put can be taken over by key, htmlvar or even by field type and location output.

Now the output of our custom field will be the twitter feed:
cf5

If for example you set the field to be allowed to be added to the map bubble but did not want to output the full twitter feed in the bubble you could simply check the $location var is equal to ‘mapbubble’ and if so output just a link to the user feed.

A link to this example as a plugin can be found here.

The change log for the new release v 1.6.6 can be found here

Please remember that both Core and Add-ons should be kept up to date. If you update the core plugin you must update the add-ons too!

Also remember to open new topic to report any kind of problem in the correct support forum.

We hope you enjoy these new releases!

The GeoDirectory Team

One thought on “Custom field improvements in New V1.6.6

Leave a Reply

Your email address will not be published. Required fields are marked *

Share This