-
AuthorPosts
-
May 2, 2024 at 12:41 am #1441681
Hi, I’m having a similar problem to the one I had in 2019 with the Enfold / WordPress updates affecting the way the child theme functions.php is supposed to work. The link to that ticket is https://kriesi.at/support/topic/error-with-enfold-child-theme-functions-php-move-search-icon-since-wp5-2-upgrade/
When I performed the updates the search box is now appearing in the top left above the logo where it is not supposed to be. The search box in the top bar to the right is where we have placed the search icon. In Enfold’s child theme functions.php, we have been using the following:
function av_move_search(){
?>
<script>
/* appends search button to the top secondary menu */
jQuery(window).load(function(){
jQuery(“#menu-item-search”).detach().appendTo(‘#header_meta .sub_menu ul’)
});
</script>
<?php
}
add_action(‘wp_footer’, ‘av_move_search’);It has worked fine except for the glitchy problem in 2019, which we resolved by rolling back the WordPress version and then waiting a bit to update. This time though I thought I’d leave it for you to see so you can advise us on a better approach for when this happens. Could you please take a look? Thank you.
May 2, 2024 at 9:15 am #1441824Hey GWS,
If you want to remove the seach field on the left, then please try this in Quick CSS:
#header_main #searchform { display: none; }
Best regards,
RikardMay 2, 2024 at 3:25 pm #1441931That worked! Thank you so much for the fast response, Rikard!
May 2, 2024 at 5:12 pm #1441942and please think of since jQuery 3 the
(window).load(
is deprecated – it is now :(window).on('load',
( purely cosmetic – I personally prefer to write all jQuery as $ – and redeclare it by wrapping it in a jQuery function. )function av_move_search(){ ?> <script type="text/javascript"> (function($){ $(window).on('load', function(){ $('#menu-item-search').detach().appendTo('#header_meta .sub_menu ul'); }); })(jQuery); </script> <?php } add_action('wp_footer', 'av_move_search');
by the way: your cloudflare security blocks your website (on all of my browser – even on those where i do not run µBlock or private window only.
May 2, 2024 at 5:36 pm #1441944@Guenni007, thank you for your advice on the jQuery. I’ve updated the functions.php file per your suggestion and all appears to be in working order.
May 2, 2024 at 6:38 pm #1441977by the way – same thing on
.click(function() {
it is now:
.on('click', function() {
-
AuthorPosts
- You must be logged in to reply to this topic.