Address layout customization
This topic contains 8 replies, has 5 voices, and was last updated by Paolo 5 years, 4 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: address, formatting, layout, v2
-
AuthorPosts
-
May 9, 2019 at 7:51 am #485274
Dear support team,
I am trying to customize the address layout in geodirectory V2, in general (map bubble, details page, sidebar) and am having some issues. From my searches I always find the V1 solution (“geodir_show_post_address” filter, which worked like a charm in V1) or a reference to the V2 GD Post Address element/widget.
The format I have now (see example here: https://pan.clients.amweb.ch/indirizzi/bellinzona/attivita-ricreative/centro-diurno-bellinzona-gruppo-atte/):
ADDRESS
CITY
REGION/CANTON
ZIPCODE
COUNTRYThe format I would need:
PLACE NAME
ADDRESS
ZIP CITYThe GD Post Address solution works with some limitations on the details page (I manage to obtain the correct layout, but would like to display a complete address, adding also the place name with the address, as shown above), but in the other places the GD Post Address element is of little use. I could insert it in the sidebar as a widget, but this would bring up a duplicate with the address already shown in the “Output Location” widget, and I found no place where to correct the formatting for the map bubble, so this part still remains a mistery…
Concerning the place title, I could use the corresponding element/widget, but unfortunately in the advanced options you only offer me H1, H2 and H3 as display options, which would not fit into my layout in this case (a simple bold tag would be ideal, or even a span/div/p that I could format with CSS).Is there some code that would allow me to change the default address layout overall in my website (considering that I also need to add the place title)?
Does the GD Post Address element accept a tag (like %%post_title_br%% or similar) to display the place title together with the address?
Also, would it be possible to insert an option to change the address layout in the GD settings page in a future release, given that GD is used worldwide and each country/region has its very specific address layout? This would probably make more than one user happy, and avoid you some recurring support requests about address layouts…
Thank you very much in advance for your help, which is as always greatly appreciated.
May 9, 2019 at 7:57 am #485276Hi AMWeb,
Thanks for your post. Could you refer to this article and see if it helps? https://wpgeodirectory.com/docs-v2/geodirectory/design-elements/#gd_post_address
Let us know how it goes.
May 9, 2019 at 8:08 am #485281Hi Kor,
Thank you for your reply.
Unfortunately, as I wrote in my original request, the GD Post Address element is only of a limited help (and unfortunately the documentation about it is equally limited as it seems to me). I managed to display a more or less correct address in the place detail, by inserting the following two elements:
[gd_post_title tag='b' ] [gd_post_address title='' id='' show='value' address_template='%%street_br%% %%zip%% %%city_br%%' alignment='' text_alignment='' list_hide='' list_hide_secondary='' ]
In the sidebar the address is displayed through an “Output Location” widget (and by adding the sidebar under the Place settings, in “Show in extra output location”). Unfortunately this item provides no formatting/layout options.
The same goes for the map bubble (also added under “Show in extra output location”), where no formatting/layout option is available.I could “reconstruct” the whole layout in the sidebar, by using individual widgets instead of the single “Output Location” (even though it would be quite annoying to get the same layout, and additionally the actual usefulness of the “Output Location” widget would be questioned in this case…).
Concerning the map bubble, how exactly am I supposed to add the GD Post Address element to the map bubble?
May 9, 2019 at 4:19 pm #485351Hi,
the output location widget is the default sidebar that GDV1 offered.
Believe or not, it is good as it is for well over 50% of users.
It’s a quick ready-made solution.
For anyone wanting something different, they have full control, by removing the Output Location widget and rebuilding it with single widgets that give you more options. Basically what you assumed was correct.
For the map bubble a code snippet is required… I flagged your request for the developers who will get back to you asap.
Thanks
May 9, 2019 at 6:24 pm #485379Hello,
Firstly thanks for the suggestion, from the next release (2.0.0.59+) %%post_title%% will be supported.
There are many ways to do what u want let me give you two.
If you want to change the address format everywhere on your site then you can use the following snippet (it will override widget settings)
add_filter("geodir_cf_address_template","_my_address_template",10); function _my_address_template($address_template){ // set this to whatever you need $address_template = "%%street_br%% %%neighbourhood_br%% %%city_br%% %%region_br%% %%zip_br%% %%country%%"; return $address_template; }
If you want to alter the map bubble address, you might be best unsetting it to show in the bubble under the custom field address output locations setting and then use this code snippet:
add_filter("geodir_show_listing_info","_my_map_address_add",10,2); function _my_map_address_add($html,$fields_location){ if($fields_location=='mapbubble'){ $html = do_shortcode('[gd_post_address show="icon-label-value" address_template="%%post_title%% %%post_title_br%% :: %%street_br%% %%neighbourhood_br%% %%city_br%% %%region_br%% %%zip_br%% %%country%%"]').$html; } return $html; }
Thanks,
Stiofan
May 10, 2019 at 8:30 am #485539Hi Stiofan,
Thank you for the quick and very effective solution, the “geodir_cf_address_template” filter was exactly what I needed and it worked like a charm!
Would it be possible to list these two snippets (and other similar “gems”) in the docs somewhere? I suppose it would be useful to other users in my situation (and also for future reference). Right now there is quite extensive documentation about the design elements, but unfortunately not about filters and code changes like these (as there was in V1). I know that V2 is way more effective and powerful as V1, and also requires less “hacks” to work as expected, but as my case has shown there are still situations where some code intervention is needed.
Wow, thank you also for including support for %%post_title%% already in the next release. This is worth a big thumbs up!
May 10, 2019 at 4:23 pm #485663This reply has been marked as private.June 12, 2019 at 10:09 am #492467I have not yet understood how to format the streetname with the number. I need to have the number after the streetname and not before that. Do not understand why you can not embed the number in a html span, then you could have solved that with CSS.
June 12, 2019 at 8:00 pm #492574Just enter the address street with the number after the street name and it will appear that way in the front end.
To put it in a separate SPAN we would have to add a field only for the street number and that is not going to happen.
Thanks
p.s. please always open your own tickets rather than posting in old topics of other people.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket