Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1377022

    Hi,

    We’re using this function to move the search from the main menu to the top-menu (meta-bar). It works on all websites without any problems.

    
    //--------------------------------------------------------------
    // Move Search to Top-Menu
    //--------------------------------------------------------------
    add_action('wp_footer', 'ava_custom_script');
    function ava_custom_script(){
    ?>
    <script type="text/javascript">
    (function($) {
    	$(window).load(function() {
    		$("#menu-item-search").detach().appendTo('#header_meta #avia2-menu');
    	});
    })(jQuery);
    </script>
    <?php
    }
    

    However it won’t work on a new website, currently in development. And I don’t know why. Any suggestions? Link to the website in private content.

    Regards,
    Bernd

    #1377062

    Hey Bernd,

    Thank you for the inquiry.

    The script is not working because it is triggered before the jQuery library is loaded. We adjusted the priority of the hook a bit so that the script renders after jQuery loads.

    //--------------------------------------------------------------
    // Move Search to Top-Menu
    //--------------------------------------------------------------
    add_action('wp_footer', 'ava_custom_script', 9999);
    function ava_custom_script(){
    ?>
    <script type="text/javascript">
    (function($) {
    	$(window).load(function() {
    		$("#menu-item-search").detach().appendTo('#header_meta #avia2-menu');
    	});
    })(jQuery);
    </script>
    <?php
    }

    Best regards,
    Ismael

    #1377081

    Hi Ismael

    Thanks a lot! Now it works :-)
    You can close this topic.

    Regards and happy holidays
    Bernd

    #1377122

    Hi,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1377197

    Hi Rikard,

    As I already wrote in my last answer, you can close this topic ;-)

    Best regards,
    Bernd

    #1377206

    Hi Bernd,

    We are happy that Ismael could help! :)

    For your information, you can take a look at Enfold documentation here – https://kriesi.at/documentation/enfold/

    If you have any other questions or issues, feel free to start a new thread under Enfold sub forum and we will gladly try to help you :)

    Happy Holidays!

    Best regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Move search to meta-bar’ is closed to new replies.