Support » Plugins and Hacks » Filter Placemarks Revisited

Filter Placemarks Revisited

  • Ian,
    I want to start off by saying awesome job. I’m really liking this plugin. Having said that, I wanted to revisit a post you made here: http://wordpress.org/support/topic/plugin-basic-google-maps-placemarks-filter-placemarks?replies=3.

    I thought the markers were an overlay and could easily be hidden using jQuery. However, upon testing, it seems that the markers are a little more complicated than that. Is there a way to target a marker after it’s been created? When you create a new google.maps.Marker there’s no class or anything defined to differentiate the markers. Is that functionality that could be easily added? I was thinking it would be pretty easy to link them to their category since that’s how they are being shown/notshown already.

    If that is not the case then my next question is as follows: You mentioned using PHP to hide the classes. PHP itself is server side and wouldn’t be able to do this on the fly like javascript would. Could you think of a way that we could use AJAX to reload the map with new category options for the setBGMPMapShortcodeArguments filter?


Viewing 15 replies - 31 through 45 (of 79 total)
  • http://pastebin.com/jtQVv4uh

    This is my mapPage.php. I use it to display the map. I may have forgotten something along the lines of my creating this. I guess run a compare and see if that fixes your issues. I have a feeling it has something to do with me stuffing everything in that map div.

    I just did what you had on your page, only I’m not getting a menu, the only thing I get is this:


    Have you set any categories up in the plugin? The categories are what create the nav. Also, check to make sure you have the latest jquery. That may cause some conflicts as well. Preventing the divs from being created.

    Check to make sure you have a div with the id filteredNav. That is the one that creates the navigation. It is created in the javascript here:

    if ($('#map').length) {
    		$('#map').append("<div id='filteredNav' /><hr /><div id='mapLocs' style='padding-left:30px;' />");
    		$.each($.bgmp.markers, function(index, arr) {
    			$('#filteredNav').append('<button class="fNav shown" value='+$.bgmp.markers[index]+''+'>'+$.bgmp.markers[index]+'</button>');
    Plugin Author Ian Dunn


    1.9.3-rc2 is now available, which adds the code changes we talked about earlier to support extending the plugin for your custom code.

    I found a example of what I meant by the category menu: look at this stuff, I know that it works with “hide (category)” and “show (category)” php code.
    I only have no idea how to program any of this stuff.

    Look at this here: http://econym.org.uk/gmap/example_categories.htm

    DvdVlag, That’s what my changes accomplish. There are 5 files, 2 (core.php and the javascript from the plugin), 2 I added (my javascript file and mapPage.php) and changes I added to function.php (I need to pull them out, but they are fine for now.) After that all you have to do is create a new page change its type to mapPage.php All of this should be posted throughout these 3x posts.

    http://capsoftinc.com/dev/esmm/wordpress/ is the dev page where Ive worked on this. You will have to go to Columbia, SC though to see the filterable results. Again, this is merely a test page. So it looks like crap and could have several bugs.

    Ian, I haven’t worked on this project in a while, but when I get back around to it, I’ll definitely take a look at merging it with the new RC.

    jesse.t, youre custom code does exactly what I am looking to do. Fantastic work. The problem is, I have no idea how to implement it on my site… the functionality is pretty basic: have a menu that will allow users to show/hide markers based on their category. I read this whole thread as carefully as I could but I still have no idea where to begin. Thanks for any help you can provide.

    I’m not sure how thorough you read this topic, but the post right above kind of puts the pieces together. If you have no experience in editing php/etc this will be a bit of a pain to put together, but if you really want it and are willing to learn to accomplish it, you should be able to do it.

    Simply put, download all the files Ive attached throughout the post. Should be a core.php, functions.js, test.js and mapPag.php. The core.php & functions.js overwrite the ones in the plugin. Be sure you back up the originals as they might not work with your version of the plugin. (I’m on 1.9RC2 I believe.) Place mapPage.php into your themes root directory and assign the page your map will be that template. I should have pasted some code for my function.php file as well that needs to be added to your themes function.php file. Read about why I did this on the installation FAQ: http://wordpress.org/extend/plugins/basic-google-maps-placemarks/installation/ do_shortcode. It should explain that.

    That should be all thats necessary. I should forewarn that it’s an old version and I have found several bugs. I haven’t been able to release a new version yet as I’m still working on it and I’m not sure how much work would be required to make it work yet.

    Thanks for the clarification. I really appreciate it.
    I have (backed up and) overwritten core.php and functions.php and created mapPage.php in my theme root, and set it as my map page template.

    Am I supposed to use all of your re-written functions.php (including the CUSTOM JAVASCRIPT) as it is, or am I supposed to do something else with that script?

    Also, I can’t find any mention of test.js on this thread.

    Right now, it looks like I’m getting close, i just can’t ge the category buttons to load

    see: http://bit.ly/10Gax5C

    Again, thanks so much for your work and sharing. Sorry to be a bother.

    It never fails me how people automatically put an i in my name. I’d make a pretty ugly woman, don’t you think? All jokes aside, I apologize: It has been a while since I posted my information: If you look here: http://pastebin.com/n60VidcW. You will see that the pastebin is split into 2 JS’s. The later, separated by:

    /************CUSTOM JAVASCRIPT************************/

    Is my test.js. Please paste that into a separate javascript and load it on your site. Let me know the results. I have fixed a lot of issues and will release my latest code if you are capable of getting it working.

    First, sorry about the name gaff.
    How do I load test.js? I’ve tried using wp_enqueue_script in the header, template file and in a functionality plugin but I really have no idea if I am doing it right.
    Thanks again

    The easiest way is to just hard code it into your header, but thats not the best way. enqueue script would probably be ideal. Also, you can name the js file whatever you want. I only named it that as this was more of a concept initially. Just make sure jquery is loaded first. I noticed I had issues with the jquery that wordpress uses, so I ended up pulling Googles. Not sure what kind of issues you may run into with other plugins, but if you have the same issue try adding the following to the bottom of your themes function.php:

    function addjQueryUI() {
    	wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js',false,'1.8.3',false);
    add_action('wp_enqueue_scripts', 'addjQueryUI');

    I am checking to see what you’ve come up with using my code.. I noticed on your site that you are getting a javascript error.
    TypeError: $ is undefined $.geocoder;

    Try replacing the $ with jQuery and see if that doesn’t make things work better for you.

    I haven’t had a chance to get back to it. we opted to roll the map out as a post-launch feature but as soon as I get through the initial launch of the site I’m diving right back into it. Thanks so much for your help. When I get this working I’ll have to paypal you the cost of a beer in your locality.

    I assumed you meant in test.js
    I did that and have still not managed to get it to work.
    Interested in some small contract work? I just want to get this up and running

Viewing 15 replies - 31 through 45 (of 79 total)
  • The topic ‘Filter Placemarks Revisited’ is closed to new replies.