How-to change the tabs order for ClassiPress Ad sidebar
This is a simple How-To where we will explain how to change the order of tabs for the Ad-Sidebar avoiding the problem with the refresh of the google maps widget:
1- Modify the file wp-content/themes/classipress/sidebar-ad.php: In this example, we move the map tab to the third position in the tab panel:
<a href="#priceblock2"><span class="big"> < ?php _e('Contact', 'appthemes') ?></span></a> <ul class="tabnavig"> <li><a href="#priceblock3"><span class="big"> < ?php _e('Poster', 'appthemes') ?></span></a></li> < ?php if ( $gmap_active ) { ?> <li><a href="#priceblock1"><span class="big">< ?php _e('Map', 'appthemes') ?></span> < ?php } ?> </a></li> </ul>
Now, we have the google maps widget problem, because if this tab is not the first, the map don’t load completely because the div is hidden. To solve that, we need to make two more simple mods:
2- Inlude at the end of the file wp-content/themes/classipress/sidebar-ad.php this code:
<script> jQuery(document).ready(function() { jQuery ('a[href=#priceblock1]').click(function(){ jQuery ('#map').hide(); load (); jQuery ('#map').fadeIn(500); codeAddress (); google.maps.event.trigger(map, 'resize'); }); }); </script>
3- Modify the file themes/classipress/includes/sidebar-gmap.php: Basically, we comment the initialization code for the map widget, because we did before with the previous mod. Then, we need to make the map variable global by removing the ‘var’ key word:
//< ![CDATA[ // jQuery(document).ready(function($) { // $('#map').hide(); // load(); // $('#map').fadeIn(1000) // codeAddress(); // }); map = null;
Rosario
24/01/2012 @ 00:01
Ciao, se guardi il mio sito, google maps non funziona.
Potresti postare il sidebar-ad.php completo?
Ryan
09/11/2013 @ 22:24
Thank you very much.
I have applied your method and it worked flawlessly.
PS. On point 3 (sidebar-gmap.php) all i did was change priceblock1 to priceblock3
alucas
13/11/2013 @ 11:44
I’m glad this tutorial was helpful for you :)
Alyah
16/03/2015 @ 03:01
Thank you this solved one of my issues another issue that I have is why the Poster Private Messages aren’t being delivered within the Side Bar Ad contact?
alucas
16/03/2015 @ 11:36
Hello Alyah
Thanks, glad to help!
With private messages, do you mean the email to the author?
Regards
Henrique
30/06/2015 @ 19:29
Good morning, I loved your tutorial.
But I wonder, can i add the phone just above the contact fields?
Thank you.
alucas
30/06/2015 @ 19:45
Hi Henrique
Thanks. The phone number is a custom field, so you need to show up this info using the wordpress API.
Regards
jose
16/12/2015 @ 05:58
Hi! please help me, i need put the googlemaps when i post an add, so i can to use a pushpin for locate a shop or hotel.
how i can do it.
alucas
16/12/2015 @ 11:08
Hello Jose
This feature will require customization. Maybe you could request a quote and will be glad to quote this customization for you.
Regards