• Resolved cutu234

    (@cutu234)


    We would like to show the map on the frontpage. The locations (markers) should be shown on page load, but not the results below the map. This would take too much space. The results should be visible after the user clicked the search button. Is this even possible? Or does it not work like that due to the ajax functionality? I could uncheck “show location on load”, but this would remove the markers in the map which we would like to keep.

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, thanks for your inquiry.

    Well, I believe that could be done although I haven’t tried it myself. We could think of the following workaround using a bit of CSS and Javascript.

    First add this CSS rule in Appearance > Customize > Additional CSS or wherever you put your custom CSS. This way we make the search results hidden by default:

    #wpsl-stores { display: none; }

    Then add this jQuery snippet, so that when we click the “search” button, the results are shown:

    add_action( 'wp_footer', function () { ?>
    <script type='text/javascript'>   
      jQuery( document ).ready(function() {
        jQuery( document ).ajaxComplete(function() {
            jQuery('#wpsl-search-btn').click(function(){
                jQuery ('#wpsl-stores').css('display', 'block');
            });
        });
      });
    </script>
    <?php } );

    I hope that helps.
    Best regards,

    Thread Starter cutu234

    (@cutu234)

    This works like a charm. Thanks a lot. Awesome support!

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