Forums Forums Search & Filter Pro Empty search result

Viewing 8 posts - 1 through 8 (of 8 total)
  • Anonymous
    #14730

    Hi Ross

    Is there a way to have an ’empty search’ result in ‘Nothing Found’? Currently an empty search displays all custom post entries (within defined categories).

    Many thanks
    Nick

    Ross Moderator
    #14755

    Hey Nick

    This is not an option within S&F, but you could modify you template to do something similar.

    Basically you would have to edit hte template that is being used for displaying results, and add in custom logic/code that would detect these conditions.

    Thanks

    Anonymous
    #14780
    This reply has been marked as private.
    Ross Moderator
    #14781

    Hi Nick

    This kind of work is a little out of scope of support here – you will need to modify your results template to do various things that you want it to do.

    Such as adding in conditions – for example a common one would be

    if($query->have_posts())
    {
         //this means there are results - run the loop/results
    }
    else
    {
        //show message when there are no results
    }

    Taken from: https://codex.wordpress.org/Function_Reference/have_posts

    If you want to do specific things when there are no results found, then you must develop this feature yourself as it is very specific to your needs.

    Thanks

    Anonymous
    #14974
    This reply has been marked as private.
    Ross Moderator
    #15009

    Hi Nick

    This is a template issue which is defined by your theme, so theres not much more I can do without digging around your theme and trying to figure out what its doing.

    It sounds like to me that you just need a hand customising your results template, so it shows posts under certain conditions and not others.

    There are plenty of resources on this you can find via a google search, just so you know, creating a template for Search & Filter (if using ‘display results’ -> ‘as archive’ in settings) is just the same as creating a regular WP search template, or an archive template – here is a link which has some examples of behaviours you can add:

    http://jamescollings.co.uk/blog/wordpress-search-results-page-modifications/

    If you are unable to make the modifications I suggest asking for help on WP websites as I am unable to do this for you.

    Thanks

    Anonymous
    #15042

    Hi Ross

    Thanks again for your help, found a temporary solution by adding ‘required’ to the input in class-search-filter-display-shortcode.php so I guess this can be marked as resolved.

    Cheers
    Nick

    Ross Moderator
    #15049

    Glad you got it working 🙂

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