Forums Forums Search & Filter Pro Results page identity incorrect

Viewing 10 posts - 1 through 10 (of 13 total)
  • Anonymous
    #8183

    Hi there,

    Plugin seems to be working fine functionally generally, but no matter what template I select (e.g. search.php), the results are being deemed as being on the general blog listing page as far as the meta Title and Breadcrumbs are concerned, and so in relation to that instead of getting a body class of “search search-results” (as per the usual WP search results) I’m getting “blog”, which is throwing off some CSS styling I’m using on the page.

    Any suggestions as to what I should do so WP recognises the page as a search results?
    (To confirm the functionality is working but WP doesn’t seem to know it’s a search result page.)

    Cheers
    John

    Ross Moderator
    #8192

    Hey John

    The plugin does not perform a native WP search or set is_search to true – so the best thing you can do is duplicate a template that has the results/layout you like, set this template file under use custom template and then edit the template file to achieve what you need

    This link should help in customising your template file:

    http://codex.wordpress.org/Function_Reference/body_class

    Thanks

    Anonymous
    #8223

    Thanks for getting back to me Ross.

    I’ve already got a template set up, and the layout is fine minus those bits related to the body classes, which I can indeed solve as suggested (ta).

    The template is still showing as being in the blog though, despite the search being for a custom post type. I obviously want the custom post type details in the meta etc, so how do I set things up so that these details are right? I’ve tried setting up a separate search Page which is fine until a search request is submitted, at which point the results are still shown on what appears to be the blog/index template.

    Any suggestions?

    Thanks
    John

    Ross Moderator
    #8251

    Hey John its a little hard to follow (and figure out what is going on) without being able to see it.

    Would you be able to send over a link in a private message?

    Thanks

    Anonymous
    #8360

    Hi Ross,

    Sorry, I know what you mean but bear with me as it’s a bit of a mess in there at the moment.

    Besides, I think I’ve found the issue. In the old/free version of S&F you had “add_search_param” to add the &s= into the querystring. If I manually (in the address bar) add this then it all works just fine. Without it any paging loses the formatting and the template forgets it’s a search page and the title tag reverts to blog (instead of showing the search term).

    I can’t find a setting in the Pro version to add this, and just adding it to the shortcode doesn’t seem to do anything.

    According to the changelog you added this as of 1.1.1 for an empty search, but this doesn’t seem to be the case now, and it certainly isn’t there on the pagination.

    To summarise, it appears I need s= in the querystring at all times… is there a setting to achieve this?

    Thanks
    John

    Ross Moderator
    #8371

    Hey John

    The pro version works a bit different to the free…

    Adding a ?s will likely force WordPress to load a search results template.

    However in the pro version you can force the correct template without having this in the URL, instead you must tick (in the settings panel) – “use custom template” and then you must enter the filename of your search template, probably search.php – have you tried this?

    Thanks

    Anonymous
    #8372

    Hi Ross,

    I want it to load the search results template, as nothing else seems to achieve what I’m after.

    I’ve tried (am using) the custom template (it is indeed search.php), and whilst this pulls up the right template it doesn’t recognise it’s a search (as no ?s) and thus thinks its a blog listing page and shows the wrong meta title etc upon paging. That’s my problem. Functionality the search seems okay, but this little thing is stopping it being usable. I’m loathed to go back to scratch and coding up a new search myself when it’s so close.

    It seems strange that the Pro version doesn’t have a feature of the Free version?

    Can I add the ?s= via a setting/filter somehow so it’ll stay during paging?

    Cheers
    John

    Ross Moderator
    #8373

    Hi John

    Can you try something for me?

    In the file:

    search-filter-pro/public/includes/class-search-filter-setup-query.php

    Can you add this code:

    $query->set('is_search', true);

    to line 94?

    Just above the return $query;

    Let me know what happens

    Thanks

    Anonymous
    #8374

    Lines numbers don’t match up for me, but I’m assuming it’s the filter_query function. So inserted above the return on line 91.

    If so then nothing happened I’m afraid 🙁

    For reference it’s fine if there is a search term (as there is a s=)… the problem is when I’m filtering without a search term (but this was also the case before).

    PS – Whilst I’m here I’ve spotted a possible bug (unless me again!). On the AJAX search the results count doesn’t change (for me at least) until you’ve paged.

    Ross Moderator
    #8377

    Hi John

    I just tested on another theme and that didn’t work but an alternative line of:

    $query->is_search = true;
    $query->set("is_search", true);

    Try to set these?

    I think what is happening, is your search template is using the built in is_search function to display your results in different ways – so adding ?s= is working for your setup – I think the right way to do modify this would be to udpate your template but as you already had it working with the free plugin (which did many things wrong!) I think the above should be a workaround.

    In the settings, when you enter the custom template, and you enter search.php – does it retain the template name when after saving? Ie, when you save the Form do you still see search.php entered in the custom template section?

    Thanks

Viewing 10 posts - 1 through 10 (of 13 total)