Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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.

    #1441824

    Hey 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,
    Rikard

    #1441931

    That worked! Thank you so much for the fast response, Rikard!

    #1441942

    and 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.

    #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.

    #1441977

    by the way – same thing on

    .click(function() {
    

    it is now:

    .on('click', function() {
    
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.