Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1407380

    Hi,
    is it possible to display as soon as the page loads, the search field in the menu? By default, you must click on the magnifying glass logo to display it.
    It is also not present in the code until you click on this logo.
    His class is avia-search-tooltip if that can help.
    Best regards,
    Guillaume

    #1407408

    Hey ae2agence44,

    Thank you for the inquiry.

    You can add this script in the functions.php file to automatically open the AJAX search on page load.

    // custom scripts
    function ava_custom_script_script()
    {
        ?>
        <script type="text/javascript">
            (function($) {
                // open search bar on load
                $(document).ready(function() {
                    $('#top #menu-item-search a').trigger('click');
                });
            })(jQuery);
        </script>
        <?php
    }
    add_action( 'wp_footer', 'ava_custom_script_script', 9999 );
    

    Please make sure to purge the cache and do a hard refresh before testing.

    Best regards,
    Ismael

    #1407423

    Hi,
    Thanks very much ! It works well.
    Best regards.

    #1407506

    Hi ae2agence44,

    I’m glad that Ismael could help you :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘display the search field as soon as a page loads’ is closed to new replies.