Current status of the Ning Platform is always available on the Ning Status Blog.

NC for Hire

Ok so someone I am helping with their Ning community has a lot of locations which are mentioned throughout their site and they were wondering how we could change those locations into maps automatically.  I am going to show you how to do two things like this..  First how to change an address into a link to google maps automatically and second, how to convert mentions of a location into an autogenerated map.

It'll look something like this

Ok so say you or your members add a bit of HTML to a post like this:

<br>
Automatically Generated Google Maps link:
<address class="link">
30 Rockafeller plaza
<br>
New York, NY 10112
</address>
<br>
Automatically Generated Embedded Google Map:
<address class="map">
30 Rockafeller plaza, New York NY 10112
</address>

After you add the following snippet of jquery code to your Custom Code (bottom).....

<script>

//Generate a link to google maps
x$(document).ready(function () {
//Convert address tags to google map links
x$('address.link').each(function () {
var link = "<a href='https://maps.google.com/maps?q=" + encodeURIComponent( x$(this).text() ) + "' target='_blank'>" + x$(this).html() + "</a>";
x$(this).html(link);
});
});

///Generate a google embeded map
x$(document).ready(function(){
//Convert address tags to google embedded map
x$("address.map").each(function(){
var embed ="<iframe width='425' height='350' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://maps.google.com/maps?&amp;q="+ encodeURIComponent( $(this).text() ) +"&amp;output=embed'></iframe>";
x$(this).html(embed);

});
});

 

</script>

 

Whenever anyone on your site wraps their location text inside either  of the two following HTML brackets, it will generate a map:

<address class="link">  LOCATION </address>

 

or

 

<address class="map">  LOCATION  </address>

 

Do you find this to be useful? Let me know..

You need to be a member of Ning Creators Social Network to add comments!

Join Ning Creators Social Network

Email me when people reply –

Replies

  • NC for Hire

    Honestly this is one of the best tips I ever added to this community... I am surprised more creators are not using it!

  • NC for Hire

    so glad  i had this backed up...

This reply was deleted.
 

Some interesting articles related to community management, digital marketing etc. could be found in our digest. Don't hesitate to leave a feedback so we would know that we should continue :-)

Latest Activity

⚡JFarrow⌁ posted a discussion
If your Ning site has a dark theme, you may be scratching your head wondering how to make the text…
yesterday
Fabricio Giugni replied to Fabricio Giugni's discussion
Blog help needed.
"Hi JFarrow,
Thanks for helping. I don't know much about codes. How to add class="align-left" to the…"
Friday
Fabricio Giugni replied to Fabricio Giugni's discussion
Blog help needed.
"Hi Bizz, 
Thanks for helping. It happen with Image as well. Here is the linkhttps://gplay.com.br/bl…"
Friday
Fabricio Giugni replied to Fabricio Giugni's discussion
Website is too slow. How can I fix it?
"Hi JFarrow,Is there any way to compress and reupload my member's content? All Those Photos are from…"
Friday
⚡JFarrow⌁ commented on Ana Massien's blog post FREE SSL Certificates
"agreed"
Thursday
⚡JFarrow⌁ replied to Fabricio Giugni's discussion
Website is too slow. How can I fix it?
"My 2 cents...
Try to minimize the amount of images loading on the home page...
You dont seem to hav…"
Thursday
⚡JFarrow⌁ posted a discussion
I've been creating topics pages inside my community and if you are doing something similar, having…
Thursday
Fabricio Giugni posted a discussion
Hi there,``My networks are not doing well. How can I fix it? Basically there is just what Ning prov…
Thursday
⚡JFarrow⌁ replied to Unpwn Producer's discussion
I need to secure my site
"Here are the simple steps but you may want to get someone to help you.
Go to cloudflare.com and sig…"
Wednesday
Unpwn Producer replied to Unpwn Producer's discussion
I need to secure my site
"Whatever makes my site not show "not secure" on the browser. Sorry, I'm not familiar with web stuff…"
Wednesday
Trị Sẹo Lồi liked Fabricio Giugni's profile
Wednesday
Trị Sẹo Lồi updated their profile
Wednesday
More…

Meanwhile, you can check our social media channels