How to turn off for mobile but then use built in search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to turn off for mobile but then use built in search

This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 7 years, 11 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #8484
    imagefact
    imagefact
    Participant

    Hi,

    On a site I’m building I’d like to have AjaxSearchPro for desktop, but hide it for mobile where I’d like to replace it with the built in search widget.

    I see there’s a button to disable for mobile, but this doesn’t all the regular widget to then be active.

    I was planning on Hiding (display:none) your searchbox — but the problem is it is still disengaging the built in search….

    SO. How to do this?

    – OR –

    Can I use your search field to type in a request, but then have it just jump to the built in search WITHOUT popping up the the inbetwen results lightbox… The reason overall is the your plugin, while nice, is very clunky on mobile, so I need to send users to a full screen results page.

    Thanks in advance. I see you’ve done a huge amount of work on this plugin and it shows.

    #8490
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Indeed, that option is not working correctly, it should display the default engine if it’s checked. I’m planning to extend that options page, whit more settings.

    I think the best solution would be to suggest you a temporary fix for the issue with the theme search replacement. Open up the wp-content\plugins\ajax-search-pro\includes\classes\filters\class-asp-formoverride.php file, it’s a small file, and replace this code:

    function handle( $form = "" ) {
        $asp_st_override = get_option("asp_st_override", -1);
    
        if ( $asp_st_override > -1 && wd_asp()->instances->exists( $asp_st_override ) )
            return do_shortcode("[wpdreams_ajaxsearchpro id=".$asp_st_override."]");
    
        return $form;
    }

    with this code:

    function handle( $form = "" ) {
        $asp_st_override = get_option("asp_st_override", -1);
    
        if ( $asp_st_override > -1 && wd_asp()->instances->exists( $asp_st_override ) ) {
            $new_form = do_shortcode("[wpdreams_ajaxsearchpro id=".$asp_st_override."]");
            if ( strlen($new_form) != 0 )
              return $new_form;
            else
              return $form;
        }
    
        return $form;
    }

    I hope it works.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8497
    imagefact
    imagefact
    Participant

    Hi Ernest,

    Thank you for getting back to me so quickly. I had no trouble replacing the code (I do some PHP myself so I’m familiar), unfortunately it isn’t doing anything. No difference from the original… ?

    I double and triple checked it’s there, and settings.

    Just to check with you, after replacing code, the setting to change in the panel is:
    General Options > Mobile Behavior > Display the search bar on mobile devices? [OFF]

    Correct? Anything else I’m supposed to be doing so the desktop is your plugin, mobile is built in search?

    #8507
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Make sure to clear your cache (CDN, page cache, browser cache etc..), the changes might be affected by that.

    It works on my test environment, but of course I’m not sure if this is correct with every configuration. If it’s not caching, can you provide temporary back-end and FTP details so I can debug the code?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8527
    imagefact
    imagefact
    Participant

    Hi Ernest,

    Thank you. None of those apply, so it’s something else. I’ll set up a testing ground since the site in question is in constant flux as I program it… I’ll follow up soon (Thank you for your follow ups!).

    #8531
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you for that! In the meantime I did further tests on this issue, but I still didn’t find anything unfortunately. I suspect it might be relevant to a certain configuration. We will definitely find out 🙂

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8540
    imagefact
    imagefact
    Participant

    Ok, mystery solved!

    Your code worked. I was expecting it to act like a media query, so I was shrinking my browser and expecting your plugin to disappear below 768px or so. But it doesn’t.

    Now I know, it checks for mobile differently. So yes, True mobile now shows the built in search widget, while True desktop only shows ASP (your plugin).

    I THINK this will be ok. I’ll have to see the different ramifications of not having granular media query control. But for now we’ll call this done, and I look forward to the fix in the next release so I don’t have to patch each upgrade.

    I thank you very much for your terrific support. I actually have a few other (smaller) points to ask about which I’ll put in a fresh thread. THANK YOU!

    #8547
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Great! I’m glad to hear it’s working now.

    Yes, it checks for mobile based on the browser type and other properties on the server side, so the plugin is not printed at all when viewing the page, saving a tiny bit of bandwith 🙂

    I will close this thread now and mark it as resolved then.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘How to turn off for mobile but then use built in search’ is closed to new replies.