Is it possible to get a dropdown list with my categories anywhere I want ?

New home Forums Pro Add-on Is it possible to get a dropdown list with my categories anywhere I want ?

This topic contains 6 replies, has 3 voices, and was last updated by  Dylan 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #50812

    Hi,

    Your extension is great and you save me lots of time to create what I need !
    But I’m facing of an issue. I’d like find a list of my categories as a dropdown, to be able to put this one (widget?) anywhere I want on my website. After select a categorie, the user will be redirect to the map whith the filter activated.

    It seems no feature does that ? Anyway, maybe I can develop a custom plugin… but, from the documentation I didn’t find any function to get the categories I created as it’s not really a “wordpress category”. Have you a solution ?

    Thanks a lot.

    #50818

    SupportTeam
    Moderator

    Hi there,

    Thank you so much for getting in touch with us.

    There is currently no option for this, but there is a:

    function wpgmza_pro_return_category_dropdown_list($map_id, $show_all = true, $array = false)

    which will return the HTML markup for the category drop down.

    You can find this function in /wp-google-maps-pro/includes/page.categories.php line 993.

    Thanks so much,

    Kind Regards,
    Trevor Anderson

    #50873

    Hi Trevor,

    Thanks a lot for your reply.

    I’m happy to discover this function, which works great and give me the arg ‘wpgmza_cat_checkbox’ in the url’s params!
    Once I’m on the page with the map, how to filter it ?
    Do I need to code my own JS with a change() function or something like that ?

    var getUrlParameter = function getUrlParameter(sParam) {
      var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i;
    		for (i = 0; i < sURLVariables.length; i++) {
    			sParameterName = sURLVariables[i].split('=');
    			if (sParameterName[0] === sParam) {
    				return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
    			}
    		}
    	};
    	var filter = getUrlParameter('filter');
    	if (filter == null) return;
    
    	setTimeout(function () {
    		$("#wpgmza_filter_select").val(filter);
    		$("#wpgmza_filter_select").trigger("change");
    	}, 200);

    Regards,
    Jonathan LAUER

    #50875

    Hey Trevor,

    btw, I let you know you have a ‘‘ line 1023 without any

    before !
    This one close my <form> before the end 😉

    Regards,

    #50971

    Dylan
    Moderator

    Hi @wizzu,

    Thank you so much for your time on this one we do appreciate it.

    Yes, that is correct, you would need to either develop a custom JS handler to apply the filter to the map.

    The code snippet you have provided appears to be a good approach to the filter application.

    Have you had trouble with this?

    #51094

    Hi Dylan,

    Thank you for your confirmation. It works like a charm on my side with these lines of JS !

    I noticed you have fixed the issue I’ve mentionned above (about the </div > ) ! Good job 😉
    The dropdown filter is at the bottom of this page https://www.catholique65.fr

    Kind Regards,
    Jonathan LAUER

    #51120

    Dylan
    Moderator

    Hi Jonathan,

    Fantastic to hear that worked for you and thank you for sharing your website with us.

    I just had a look and this really is a great additional feature. We will look into including this in the future.

    Have a great week! 🙂

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.