-
AuthorPosts
-
April 14, 2022 at 10:38 am #1348343
Hey Enfold team,
I´d like to make some styling changes to the ajax search (which I just integrated into my website) like adjust spacing, change colors, remove shadows etc.
Please see screenshots.Also I`d like the search results to be only available in the drop-down menu after clicking the magnifying glass, with no option to go to a results page.
Is that even possible to completely prevent a redirect to a result page in a quick way?Thank you very much in advance for your reply/support.
Best regards, fkm
April 15, 2022 at 5:30 am #1348477Hey fkm,
Thank you for the inquiry.
To adjust the portfolio post type title or label, try to add this code in the functions.php file.
add_filter('avf_ajax_search_label_names','avf_ajax_search_label_names_mod', 10, 1); function avf_ajax_search_label_names_mod($label) { if($label == 'Portfolio Items') $label = 'New Label Here'; return $label; }
You can then use this css code to adjust the styles of the ajax search based on your specifications. Please make sure to toggle or temporarily disable the Enfold > Performance > File Compression settings after adding the css.
.av_ajax_search_image { border-radius: 0; } .av_ajax_search_content { top: 10px; position: relative; } #top div .av_ajax_search_entry:hover { background-color: inherit; } .avia-search-tooltip .avia-arrow-wrap { display: none; }
Best regards,
IsmaelApril 20, 2022 at 11:10 am #1348915Hey Ismael,
every single code works just fine – thank you so much.
As you adviced, I deactivated the functions for file compressions (CSS and Javascrit) under Enfold/Performance.
Should I keep it like that in the long term?In addition, please let me know how to redesign the search results box (change position, add/remove borders, adjust spacing) – please see screenshots.
Is it possible to disable the connection to the search results page and only use the above-mentioned box for the search?
If so, please let me know how to disable the redirect to a search results page feature.Thank you very much in advance.
Best regards, fkm
April 25, 2022 at 4:18 am #1349320Hi,
Thank you for following up.
The target state for the AJAX search results only works on wide screens or when the main content is located on the right side of the page as shown on your screenshot. It doesn’t work really well on smaller screens, when the main content is center aligned. The search results are not clearly visible without the white background because it blends in with the main content.
This is how the AJAX search looks like when we removed its default background and box shadow.
Screenshot: https://1drv.ms/u/s!AjjTfXSRbKTvwFbfXs8sJgniwYpI?e=mN7caF
Best regards,
IsmaelApril 25, 2022 at 10:20 am #1349367Hi Ismael,
thank you very much for your reply and for the screenshot you made.
This is a misunderstanding – please excuse, I think I was unclear:
The background was intended as a white background (not transparent), just without any borders or shadows.
Please see screenshot: https://www.dropbox.com/scl/fo/zbfksedvzvl9z4gkqf853/h?dl=0&rlkey=s0yqm92o4jsh8z409ytoi6thsThank you very much in advance for another feedback.
Best regards, fkm
April 28, 2022 at 6:38 am #1349750Hi,
Thank you for the clarification.
Try to use this css code to remove the box shadow and borders of the AJAX search container.
#top .avia-search-tooltip { box-shadow: none; border: none; }
Again, toggling the file compression settings and purging the cache might be necessary.
Best regards,
IsmaelApril 28, 2022 at 12:56 pm #1349814Hi Ismael,
thank you so much for your reply – the css code works fine.
This also allowed me to make a couple of other small styling changes on my own. :)There are still a handful things I´d like to change within this topic – I tried myself, unfortunately without success.
So I´d be very grateful for your help (please also see screenshot):1. remove the loading icon in the search field
-> I already removed the magnifying glass in the search filed using the Enfold Forums with the following css code:
#searchsubmit {
display:none;
}2. reduce the height of the search result items
3. remove the light grey background color of the search result items
4. reduce the size of the magnifying glass next to the burger menu on mobile devices
5. disable the funktion/link of being redirected to the search results page by clicking the magnifying glass or enter
Thank you very much in advance for another reply.
Best regards, fkm
April 30, 2022 at 4:41 pm #1350055Hi,
Thank you for your patience, to remove the loading icon and the item background color, try this css:#top .ajax_loading_now > div > div { opacity: 0 !important; } #top div .av_ajax_search_entry:hover { background-color: rgba(0,0,0,0) !important; }
After applying the css, please clear your browser cache and check.
Best regards,
MikeMay 2, 2022 at 11:05 am #1350165Hi Mike,
thank you so much for your reply and the css.
It works just fine – great!Please also let me know how to reduce the height of each search result to bring them closer together vertically (please see screenshot point 2).
Thanks a lot in advance.
Best regards, fkm
May 2, 2022 at 12:26 pm #1350173Hi,
Glad to hear, try changing the top and bottom padding to zero from 10px with this css:#top #menu-item-search .av_ajax_search_entry { padding: 0px 16px; }
If that is too close together try changing the top and bottom padding to 5px like this:
#top #menu-item-search .av_ajax_search_entry { padding: 5px 16px; }
try adjust the number to suit.
After applying the css, please clear your browser cache and check.Best regards,
MikeMay 3, 2022 at 10:25 am #1350279Hi Mike,
this works fine too – so motivating, thank you very much!
Please let me know the CSS to also adjust the spacing between search results and headings as well as the spacing at the bottom of the search box.
Also, the letter spacing of the headings (“Pages”, “Projects”) is a bit too wide. Please let me know how to change these.
Please see screenshots.Thanks a lot in advance.
Best regards, fkm
May 3, 2022 at 12:40 pm #1350307Hi,
Please try this code in the General Styling ▸ Quick CSS field or in the WordPress ▸ Customize ▸ Additional CSS field:#top #searchform .ajax_search_response h4 { letter-spacing: 0.10em !important; padding-bottom: 10px; } #top #searchform .ajax_search_response { padding-bottom: 10px; }
adjust the padding-bottom & letter-spacing to suit.
After applying the css, please clear your browser cache and check.Best regards,
MikeMay 4, 2022 at 10:14 am #1350437Hi Mike,
exactly like that, works great again – thank you so much!
I have three final points on this topic, for whose help I would be very grateful:
1. I´d like to reduze the size of the magnifying glass on mobile devices (I tried by myself again and again without success)
2. I´d like to stop redirecting to the search page when pressing enter/return (and in general) after typing the search term
3. when I type into the search field on the iPhone, the view zooms in. Is it possible to prevent this, too?Thanks a lot in advance for your reply.
Best regards, fkm
May 4, 2022 at 1:46 pm #1350480Hi,
To change the mobile search icon size try this css:@media only screen and (max-width: 767px) { .responsive #top #wrap_all .menu-item-search-dropdown > a { font-size: 12px !important; } }
and adjust to suit.
To stop the search form from submitting with the enter key, try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:function custom_script() { ?> <script> (function($) { $('#menu-item-search').click(function(){ setTimeout(function(){ $("form").attr('onSubmit', 'return false'); },500); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
As for the search field on the iPhone view zooms in, this is the iPhone itself and we can not change.
Best regards,
MikeMay 5, 2022 at 10:21 am #1350592Hi Mike,
everything works great, just as imagined.
I’m really happy – thank you so much! :)I just noticed during testing that the standard text for no search results is a bit long for my case:
“Entschuldigung, aber kein Eintrag erfüllt Deine Suchkriterien”
Although I spoke of “final points” before, I would like to ask you again for your help in this case.
Is it possible to shorten/change the text?
Please also see screenshot.Thanks a lot in advance.
Best regards, fkm
May 5, 2022 at 1:15 pm #1350615Hi,
Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:function ajax_not_found_text() { ?> <script> (function($){ setInterval(function () { $('#searchform .ajax_search_response .av_ajax_search_entry.ajax_not_found .av_ajax_search_content .av_ajax_search_title').text(function(index, text) { return text.replace('Entschuldigung, aber kein Eintrag erfüllt Deine Suchkriterien', 'Entschuldigung, nicht gefunden'); }); }, 50); })(jQuery); </script> <?php } add_action('wp_footer', 'ajax_not_found_text');
adjust the Entschuldigung, nicht gefunden text to suit
Best regards,
MikeMay 6, 2022 at 9:27 am #1350771Hi Mike,
it works and looks great!
So this topic can be closed.Thank you so much Mike and the Enfold team.
Best regards, fkm
May 6, 2022 at 12:31 pm #1350790Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Ajax Search Styling’ is closed to new replies.