Override default WordPress search results page not working

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Override default WordPress search results page not working

This topic contains 8 replies, has 2 voices, and was last updated by

 
Participant
6 years, 1 month ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #7018

    Participant

    Hi,

    I bought your plugin yesterday, and have been spending a few hours trying to set it up to replace the existing search box on the top nav.

    As it stands at the moment, I’ve got a couple of issues. The main one is that the “Override the default WordPress search results page?” toggle doesn’t seem to be working. I’ve set the options to redirect on click or pressing Enter, which it does, but the search results that are shown on the resulting page seem to be the standard WordPress ones, and don’t match those shown in the Ajax search.

    From other support threads, it seems there should be a parameter added to the search URL as a hook for your plugin to replace the results, but that parameter doesn’t seem to be being added (and in fact, when I put it in manually in the browser, it gets removed when the page finishes loading).

    Is this something my theme is doing (and if so, any ideas where I should start looking to fix it), or is it something to do with the plugin?

    Secondly (and this isn’t a problem with the plugin, just a request for two minutes of your time if you can spare it) — I’m trying to set up the Ajax results to show nicely in a vertical format, underneath the search box/nav bar, but the width of the main content area rather than just the width of the search box itself. I’ve got close, as you can see, by putting the php shortcode at the end of the header.php, but it goes the full width of the page (1600px on my screen) rather than width of the content area (1020px on desktop).

    My web dev skills aren’t great — I can get it to look how it should by dragging the wpdreams_asp_results_2 div around in Chrome’s Inspect Element, but when I try putting the shortcode in different places in header.php, I can’t get it work. Do you have any suggestions on which div I should wrap the php shortcode in, or another way to get it to just be the width of the menu bar above it? I’ve included the relevant piece of the header.php below. Again, I know this probably isn’t really covered by your support, but if you had a minute to look at it, I’d really appreciate it. 🙂


    <nav role="navigation">

    <div id="cb-main-menu" class="wrap clearfix">
    <?php if ( has_nav_menu( 'main' ) ) { echo $cb_main_menu; } ?>

    </div>
    <div id="cb-main-menu-mob" class="wrap clearfix"><div id="cb-mob-dropdown-main"></div><?php if ( has_nav_menu( 'main' ) ) { main_nav(); } ?></div>

    <?php echo do_shortcode('[wpdreams_ajaxsearchpro_results id=2 element="div"]'); ?>

    </nav>

    </header> <!-- end header -->

    Thanks,
    Dave

    #7032

    Hi!

    The override issue seems to be related to the theme or maybe to another plugin. If the override option is enabled, the plugin automatically appends the “asp_active=1” parameter to tell the engine it is supposed to override the results.

    An easy way to verify if the theme is related to the issue is to simply temporary switch it to the default (twenty fifteen) to see if it’s indeed working.
    Also, there is one limitation to override: it can only override posts, pages and custom post types yet. So if you have comments, terms, tags, categories or users as results, they will not display. I’m experimenting on a solution to fix this, but It’s not ready yet.

    The position seems to be all right, I wouldn’t change that. The problem there is that the menu has a media query CSS to restrict it’s width to 1020pixels minus some margin. If I were you, I would try this CSS:

    
    @media only screen and (min-width: 768px) {
        #wpdreams_asp_results_2 {
            width: 702px;
            margin: 0 auto;
        }
    }
    
    @media only screen and (min-width: 1020px) {
        #wpdreams_asp_results_2 {
            width: 940px;
            margin: 0 auto;
        }
    }
    

    With this CSS in my inspector it looked fine to me 🙂

    Best,
    Ernest Marcinko

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


    #7066

    Participant

    Great, thanks so much for your help. That CSS works perfectly!

    With the search results — I didn’t realise that comment searches weren’t included on the redirected page. I think that causes confusion for people (they choose to search in comments, type their query, hit return… and end up on a page that doesn’t have any comments on it), so for now I’ve just disabled redirection completely.

    I’d prefer to have it if I could, though — do you have any rough timeframe for when you might have a solution for it? I’m not going to hold you to it, of course, but just wondered if it was likely to be a few weeks, a few months or more. 🙂

    Thanks again!
    Dave

    #7078

    I’m really hoping I can make it work before christmas.

    I’ve made the comments working on a test environment so far, but it’s not working properly yet and the code is a total mess. I’m hoping to use the same method for users, terms and other types of results as well. The biggest problem seems to be the correct fetching the range of results based on pagination, because of the mixed content. It’s crucial for the best performance.

    This is currently the top priority alongside with other improvements, so as soon as the next update is out – this is going to be in it (at least partially if I can’t make it work with everything).

    Best,
    Ernest Marcinko

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


    #7084

    Participant

    Ahh, that’s great to hear — good luck in getting it working, and thanks so much!

    One final question, if I could — as I understand it, when I’ve enabled the Analytics Integration option, I should start seeing hits in my analytics along the lines of /ajax_search-<phrase>. I enabled it a few days ago, but haven’t seen any hits even when I test in incognito mode. When I search back for page views filtered by ‘ajax_search’, there’s nothing there.

    It’s not the end of the world if it doesn’t work, but if there’s a simple fix, I’d love to know what it is. 🙂

    Cheers,
    Dave

    #7086

    Hi!

    Make sure you are using the Universal Analitics code, otherwise it won’t work: https://developers.google.com/analytics/devguides/collection/analyticsjs/

    If you use a plugin to print the analitics code, look for an option to enable universal mode, it will do the trick 🙂

    Best,
    Ernest Marcinko

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


    #7087

    Participant

    Fantastic, thanks again. I’m using the Yoast analytics plugin, and didn’t have the ‘universal’ part enabled. I’ve done that now, so will wait a while to see if the analytics hits start showing!

    Cheers,
    Dave

    #7088

    That might be an issue even if the universal is enabled. YOAST changed the global analytics variable from “ga” to something like “__gaTracker” some time ago – just found it on their plugin page.
    I’ve coded ajax search pro based on the official google analytics code, so it uses the “ga” variable, which is not defined in your case.

    I can implement to check for that other variable in the upcoming version, but if YOAST decides to change that for whatever reason, it’s not going to work again…

    Best,
    Ernest Marcinko

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


    #7089

    Participant

    Ahh the joys of working with other plugins!

    If you could add that check in the next version, that’d be great — the Yoast plugin is pretty popular, so I doubt I’m the only one with the problem. If Yoast changes its variable name and breaks it again, well, we’ll know who to blame!

    Cheers,
    Dave

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

You must be logged in to reply to this topic.