Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › WP Default Search Not Getting Replaced.
- This topic has 14 replies, 2 voices, and was last updated 5 years, 3 months ago by
Ernest Marcinko.
-
AuthorPosts
-
January 25, 2021 at 6:12 pm #31285
diveshjotwani2617
ParticipantHello,
The wp default search is not getting replaced by the plugin. Please see the video below.
https://share.getcloudapp.com/P8ukxG61
I talked with the theme developer, and they are saying that this plugin developer can only solve the issue.
Please let me know on priority.
January 26, 2021 at 1:53 pm #31292Ernest Marcinko
KeymasterHi,
If it is not replaced automatically, then the theme has the search bar hard-coded and not using the get_search_form hook – in that case the opposite is true, they should be the ones knowing in which file is the header search bar is integrated. Please let me know if they sent you any details or instructions about that.
I am more than happy to help you with that, but I need to know which file has the header search hard-coded, so it can be replaced manually. I strognly recommed creating a child theme for that as well, so theme updates does not override any changes made to the theme files.I think there are some other issues as well, as I tried to open the header search, but nothing is shown when I’m clicking it: https://www.youtube.com/watch?v=nPIOODxyv_w&ab_channel=ErnestMarcinko
January 26, 2021 at 5:19 pm #31297diveshjotwani2617
ParticipantHello,
I talked with the theme developer, and he replied to me
That’s correct the GP Navigation Search is adding a hardcoded form.
The link: https://generatepress.com/forums/topic/replace-gp-search/#post-1272331
Provides the PHP Snippet you will use to replace the hardcoded form with that plugins shortcode.Sir, I don’t want to go for the child theme option.
Please let me know what we have to do ahead to make it work for us.
January 27, 2021 at 1:42 pm #31307Ernest Marcinko
KeymasterHi,
That snippet looks promising, you probably don’t need a child theme after all.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter( 'generate_navigation_search_output', function() { return sprintf( '<div class="navigation-search">%s</div>', do_shortcode( [wpdreams_ajaxsearchpro id=2]' ) ); } );Based on their recommended snippet, this should work.
January 27, 2021 at 3:37 pm #31311diveshjotwani2617
ParticipantHello,
Sir, after adding the above function PHP, I got the error. Please the below image link.
Please let me know further
January 27, 2021 at 3:52 pm #31313Ernest Marcinko
KeymasterMay have been an error there, try this:
add_filter( 'generate_navigation_search_output', function() { return sprintf( '<div class="navigation-search">%s</div>', do_shortcode( '[wpdreams_ajaxsearchpro id=2]' ) ); } );January 27, 2021 at 4:18 pm #31316diveshjotwani2617
ParticipantHello sir,
Can you please check both codes are the same I think?
January 27, 2021 at 4:29 pm #31317diveshjotwani2617
ParticipantHello,
Please ignore the last message.
I added the PHP, and the search gets replace by your plugin. But the plugin is not working. Please see the below video that will explain things better.
January 28, 2021 at 10:13 am #31323Ernest Marcinko
KeymasterHi,
The plugin script files are completely missing from the site footer. Make sure to clear all layers of cache, and that within a cache plugin you have not disabled the javascript file loading.
January 28, 2021 at 4:06 pm #31331diveshjotwani2617
ParticipantHello sir,
Okay, after clearing the cache plugin is working.
But there is a problem with the mobile view. Please see the below video.
https://share.getcloudapp.com/Z4u6vjE6
Let me know further.
January 29, 2021 at 1:22 pm #31343Ernest Marcinko
KeymasterThe shortcode seems to be printed 2 times by the theme in the header. Try this custom CSS to make the first one invisible on mobile screens:
@media (max-width: 768px) { .asp_m_2_1 { display: none !important; } }February 4, 2021 at 4:01 pm #31444diveshjotwani2617
ParticipantHello,
I don’t know. But there is something wrong with your plugin.
The main issue is that it is showing connection error 400. Please see the image in the attachment.
Second, all the things PHP & CSS I added after that, I’m seeing that the search bar is coming below the heater. It is hiding below the menu option. Please see the image in the attachment.
Please let me know the perfect solution.
February 4, 2021 at 4:17 pm #31451Ernest Marcinko
KeymasterPlease note, that this qualifies as a customization request, so I cannot guarantee any “perfect” solution. Placing the shortcode and implementing custom codes are developer tasks, so we cannot guarantee anything.
1. The overlap issue is caused by the incorrect z-index value on the navigation seach element, which is part of the theme itself. Try this custom CSS, it should work:
.navigation-search { z-index: 9999999999; }2. As for the error 400 issue, I switched to the custom ajax handler option. If you clear the cache it should be all right now.
February 4, 2021 at 4:27 pm #31454diveshjotwani2617
ParticipantHello,
After clearing the cache, some new issue has arisen. Please check the attached image.
The CSS for overlapping also not working as it should be.
-
This reply was modified 5 years, 4 months ago by
diveshjotwani2617.
February 5, 2021 at 2:22 pm #31472Ernest Marcinko
KeymasterInterestingly it was working just fine on any page except the home page. I switched the script compatibiltiy to “non-minified” since autoptimize will minify anyways, and now it is all right on the home page as well: https://i.imgur.com/JxCCVVf.png
It was probably a minification conflict of some sort, maybe in combination with cloudflare. Make sure to clear the browser cache as well.The CSS for overlapping also not working as it should be.
Can you please elaborate? -
This reply was modified 5 years, 4 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.