Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Divi Default Search not Replaceable
- This topic has 9 replies, 2 voices, and was last updated 3 years, 2 months ago by
Ernest Marcinko.
-
AuthorPosts
-
March 28, 2023 at 8:27 pm #41996
MLadani
ParticipantHi Ernest,
I am using the Divi Theme and unfortunately am not able to change the default search with your genius product.
The desktop version works fine as I am using the theme builder, however for the mobile version I am using the native divi search. I am unfortunately not able where to change it in the functions file.
Your help is highly appreciated.
Cheers
MarioMarch 29, 2023 at 3:10 pm #42016Ernest Marcinko
KeymasterHi Mario,
Thank you very much for your kind words!
I have looked at the front page on a mobile view, but I can’t see any default search bar there at the moment, so I am not sure where should it go or what should be replaced.
Divi has a lot of different layouts, I believe it should let you change the header in mobile view as well. I do not recommend changing their theme files, unless you are using a child theme and you know what files to change. Divi is super versatile, and I don’t know how good of an idea is to make changes in their files.
March 29, 2023 at 6:04 pm #42020MLadani
ParticipantHi Peter,
I have inserted it via shortcode now in the mobile menu, however when I click on it to search, it automatically redirects me to the search page. It seems that there is a layer over it which links me to somewhere else.
Many thanks for your help.
Cheers
MarioMarch 30, 2023 at 1:34 pm #42033Ernest Marcinko
KeymasterOkay, that is a progress.
Can you please try to add a single hash “#” character as the link for the menu item? I believe the menu link is trying to redirect as it wraps around the plugin container. The hash symbol could prevent that.
March 30, 2023 at 1:42 pm #42035MLadani
ParticipantHi Ernest,
Thanks for your feedback, but this is already in place. Kindly see attached screenshot.
I am desperate.
Cheers
MarioMarch 30, 2023 at 1:44 pm #42038Ernest Marcinko
KeymasterOkay, that means the menu must be checking that, as the link attribute is empty.
How about trying something like “#search” in there. Maybe that does something.March 30, 2023 at 1:51 pm #42040MLadani
ParticipantUnfortunately, still no luck.
Cheers
MarioMarch 30, 2023 at 2:16 pm #42045Ernest Marcinko
KeymasterOkay, let’s try something else.
Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
add_action('wp_footer', 'asp_add_footer_script', 99999); function asp_add_footer_script() { ?> <script> jQuery(function($){ $('.asp_w_container').each(function(){ let $p = $(this).parent(); // Is this a menu perhaps? if ( $p.is('a') && $p.parent().is('li') ) { $p.replaceWith($("<div>" + $p.get(0).innerHTML + "</div>")); } }); }); </script> <?php }This script will remove the link and replace it with a DIV element instead.
March 31, 2023 at 10:28 am #42070MLadani
ParticipantHi Ernest,
that worked, thank you so much. Somehow it has overflow issues. It is not as smooth. Any idea what I can do?cheers
marioApril 2, 2023 at 11:54 am #42077Ernest Marcinko
KeymasterGreat, I can probably make an integration of this for the upcoming release, will see.
I am not sure about the overflow. Can you please clarify? This code should not affect anything whatsoever regarding overflow. I didn’t notice any problems. Can you tell how can I replicate exactly?
-
AuthorPosts
- You must be logged in to reply to this topic.