VGM – Put custom fields first

New home Forums Visitor Generated Markers General queries VGM – Put custom fields first

Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #76477
    johnnyeng
    Member

    I’ve created four custom fields (firstname, lastname, name, email, phone) and I’d like to make them appear above the default fields on the Add your Marker form. Is this possible?
    Please see attached. Thank you. 🙂

    Attachments:
    You must be logged in to view attached files.

    johnnyeng

    #76487
    Matthew
    Moderator

    Hi John,

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

    Yes this may be possible using some custom JS code, thus please may I ask if you would be open to providing me the link to your map and VGM form so that I may take a closer look?

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #76492
    johnnyeng
    Member
    This reply has been marked as private.

    johnnyeng

    #76507
    Matthew
    Moderator

    Hi there,

    Thank you for your response and time on this, I really appreciate it!

    Thank you for the links, thus here is the custom JS code that will be needed:

    jQuery(function($){
        $(document).ready(function(){
            let vgmForm = $('.wpgmaps_user_form');
    
            if(vgmForm.length > 0){
                let vgmFormTable = vgmForm.find('.wpgmza_table');
                let titleInput = vgmFormTable.find('tr.wpgmza-title');
    
                vgmForm.find('[data-custom-field-id]').each(function(){
                    let field = $(this);
    
                    $(field).insertBefore(titleInput);
                })
    
                titleInput.css('margin-top', '20px');
            }
        })
    })

    Please may you save the above 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?

    Kindest Regards,
    Matthew

    #76510
    johnnyeng
    Member

    This worked a treat! Thank you so much Matthew. I very much appreciate it.

    johnnyeng

    #76512
    Matthew
    Moderator

    Hi there,

    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 further!

    Kindest Regards,
    Matthew

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