Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Show suggestions only when search is opened › Reply To: Show suggestions only when search is opened
Hi,
Well, there is no option to do that, but it might be doable via some custom code. Basically the initial opacity of the phrases container would be set to 0 (invisible) via custom CSS, then a javascript removes that once the input is focused.
Apply this code to your theme custom CSS field (if it supports it) or use the custom CSS field on the search plugin back-end.
p[id*=asp-try-] {
opacity: 0;
}
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_footer_custom_script', 999999);
function asp_footer_custom_script() {
?>
<script>
jQuery(function($){
$('input.orig').on('focus', function(){
$('p.asp-try').css('opacity', 1);
});
});
</script>
<?php
}
I believe this is as close as it gets.