Display custom field name in Modern marker list

New home Forums Pro Add-on Display custom field name in Modern marker list

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #71951
    Gabriel_CC
    Participant

    Hello,
    as the title says, I would like to display the custom field name before the value in the modern marker list, not just the value. For example:

    Parking: Yes.

    Thank you for your time!

    Gabriel

    #71972
    Matthew
    Moderator

    Hi Gabriel,

    Thank you for getting in touch with us, we do appreciate your time.

    This is indeed possible using some custom JS code which I am happy to assist you with.

    Thus please may I kindly ask if you may provide me with the link to your map page so that I may take a closer look and thus write the necessary custom code?

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #72008
    Gabriel_CC
    Participant
    This reply has been marked as private.
    #72015
    Matthew
    Moderator

    Hi Gabriel,

    Thank you for getting back to me and for your time on this, I really appreciate it!

    Thank you for the link, I have thus written the respective custom JS code needed to display the custom field labels for the modern marker listing style:

    jQuery(function($){
        WPGMZA.PopoutPanel.prototype.open = function() {
    		$(this.element).addClass("wpgmza-open");
            
            var popoutPanel = $('.wpgmza-popout-panel.wpgmza-modern-marker-listing-marker-view');
    		
            setTimeout(function(){
               $('.wpgmza-popout-panel.wpgmza-modern-marker-listing-marker-view p').each(function(){
                    var pTag = $(this);
                    console.log(pTag.attr('data-custom-field-name'));
    
                    if( pTag.attr('data-custom-field-id') == undefined ){
                    // Dont do anything
                    } else {
                    var custom_field_val = pTag.html();
                    console.log(custom_field_val);
                    var custom_field_label = pTag.attr('data-custom-field-name');
                    var reformatted = '<strong>' + custom_field_label + ': </strong>' + custom_field_val;
                    pTag.html(reformatted); 
                    }
                }); 
            }, 100);
    		
    	}
    })

    Please may you copy, paste and save the above JS code into the “Custom JS” setting block (Maps -> Settings -> Advanced Settings)?

    Once this has been done, please may you clear your browser cache and confirm if this helps?

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #72017
    Gabriel_CC
    Participant

    Hi Matthew, it worked perfectly, thank you very much!

    Gabriel

    #72018
    Matthew
    Moderator

    Hi Gabriel,

    Thank you for getting back to me and most valued time, I tremendously appreciate it!

    I am most happy to hear that, and it was my great pleasure assisting you with this.

    Please may you kindly consider reviewing our plugin at https://wordpress.org/support/plugin/wp-google-maps/reviews/#new-post?

    It would really mean the world to me! And if possible, please could I kindly ask you to mention both your name and mine in the review for administrative purposes as this would be a tremendous help?

    Should you ever require any further assistance, I am more than happy to help.

    Have a fantastic day and week further!

    Kindest Regards,
    Matthew

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.