Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Show results onload homepage
This topic contains 8 replies, has 2 voices, and was last updated by gutiseo 8 years, 3 months ago.
- AuthorPosts
- June 22, 2015 at 5:18 pm #5075
Hi,
I would like to know if it’s possible to show results custom search onload homepage. I would like to show search results in advance before user ask in search box.
And where could I change istopic results css?
Thnaks in advance.
Regards!June 23, 2015 at 11:02 am #5078Hi!
The only way is using a custom script code in your website footer. First you will need to change one setting though, in order to make the search work with 0 input characters.
1. Go to the General Options -> Behavior panel and change the “Minimal character count to trigger search” option to 0
2. Add this script to your theme footer before the closing body tag: http://pastebin.com/raw.php?i=6hymZi4h
You can change the searchPhrase variable in that code if you want to use a default search phrase.
I do not recommend changing the CSS files directly as most of them are generated dynamically based on back-end values. Moreover updating the plugin will override all of your changes.
Best,
Most of the settings you can change on the Theme Options -> Isotopic results panel.
Rather changing the CSS I recommend adding your custom CSS code to the Theme Options -> Custom CSS panel. It’s safe and does not get overridden by updates.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 23, 2015 at 12:31 pm #5080Hi Ernest,
unfortunately your solution is not working, or I’m coding wrong your code.
I have edited footer with:<script type="text/javascript"> jQuery(function($) { // Change this variable to any search prhase if you want to var searchPhrase = "Playa"; var $input = $($("input.orig").get(0)); $input.val(searchPhrase); $input.keyup(); }); </script>
I setted up behavour to “Minimal character count to trigger search” option to 0
It only shows search box with keyword “Playa” inside, but doesn’t show any results where I placed results shortcode. Only when I begin to type again it shows results.
Thanks for your quick answer. Awesome support.
Regards!
June 23, 2015 at 1:23 pm #5082Okays, I think I might know why.
I’ve made a modification to the code, please try again: http://pastebin.com/raw.php?i=6hymZi4h
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 23, 2015 at 1:50 pm #5083Hi Ernest,
I have published new code inside footer.php and still not working.
Maybe I have to set triggers in behaviour different?
My configuration in General Options -> Behavior is:
trigger when click on icon, on return and when filters changes.
and in Layout options – > Results behaviour
scroll the window to result listThank you!
June 23, 2015 at 8:56 pm #5084Oh then, definitely that’s the problem. The script is trying to trigger a key-up event, which is not working of course.
So all you need to do is change line 16 of the code I’ve given you from:
$input.keyup();
to:
$($(“.promagnifier”).get(0)).click();
And that will trigger the icon click instead, which hopefully works 🙂
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 24, 2015 at 11:05 am #5085Not working yet. Search phase has dissapear from search box and results don´t appear bellow yet.
You can take a look to my wordpress archives inside admin in Appareance -> Theme editor because footer.php is writable from there.
And trigger search when typing doesn’t work with this code.
Thanks in advance and I’m sorry to disturb you.
Regards!June 24, 2015 at 11:16 am #5086Hi!
No problem at all, happy to help you 🙂
I’ve found the problem. I suppose when copy-pasting from my previous post the double quotes (“) were glitched and displayed incorrectly.
I’ve changed them to single quotes in your theme footer.php, it seems to be working now.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
June 24, 2015 at 11:19 am #5087Thank you so much! Now it works perfect!
- AuthorPosts
You must be logged in to reply to this topic.