-
AuthorPosts
-
December 21, 2022 at 5:15 pm #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,
BerndDecember 22, 2022 at 12:45 am #1377062Hey 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,
IsmaelDecember 22, 2022 at 10:19 am #1377081Hi Ismael
Thanks a lot! Now it works :-)
You can close this topic.Regards and happy holidays
BerndDecember 22, 2022 at 3:49 pm #1377122Hi,
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,
RikardDecember 23, 2022 at 11:58 am #1377197Hi Rikard,
As I already wrote in my last answer, you can close this topic ;-)
Best regards,
BerndDecember 23, 2022 at 1:14 pm #1377206Hi 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 -
AuthorPosts
- The topic ‘Move search to meta-bar’ is closed to new replies.