Forums Forums Search & Filter Pro Display when no match found

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #31494

    Hi, thank you for the great plugin. Having had issues with previous versions I abandoned using S&F for a while but now the latest updates seem to have fixed some incompatibility issues with the theme.

    At this stage of testing the issue I have is this:

    Using display results as archive (it works great and I want it this way) when there is no match however s&f displays the WP standard “Ready to publish your first post? Get started here.

    I have tried changing WP options from latest posts to static page to no avail. This is quite annoying.

    Can S&F be configured to show a custom page or the themes template page “content-none.php” (as the theme does when using its built-in search) when there is no match in search or filter?

    Thank you in advance for your guidance.

    Anonymous
    #31647

    Just to elaborate a bit more – the premium theme has this in the search.php after the loop:

    else :
    // If no content, include the “No posts found” template.
    get_template_part( ‘content’, ‘none’ );

    endif;
    ?>

    But it seems when there is no result searching/filtering with S&F this else statement is not honored. Any idea why?

    Ross Moderator
    #31709

    Hi Niva

    It depends on the template you are using.

    So if you are in fact using search.php, then the above seems correct.

    When S&F produces a search with no results, in your template have_posts() will be false, which means the else: part of your code will be run.

    What happens when you comment out the line: //get_template_part( ‘content’, ‘none’ ); ?

    Does the message disappear?

    Thanks

    Anonymous
    #31758

    Thank you very much Ross for putting me on the right track. Indeed I had missed looking into what the content-none.pho contains (silly me!): that page has some weird conditions which I can comfortably change to display a custom message – one of those is the culprit:

     
    <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
    
    	<p><?php printf( esc_html__( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.'), admin_url( 'post-new.php' ) ); ?></p>
    
    	<?php elseif ( is_search() ) : ?>
    
    ...
    
    

    I’ll take it from here.

    The one question that remains is should I enable is_search in S&F advanced tab (although it seems it doesn’t make any difference)?

    Thank you again for the great support you are providing.

    Ross Moderator
    #31763

    Hey Niva

    is_search is an advanced setting which you should only really use if you know what you are doing.

    Basically, some themes require is_search to be true in a query in order to display the search results template correctly with S&F – most do not.

    I think its preferable to leave this off.

    Thanks

    Anonymous
    #31797

    Thank you very much Ross for the advice. All good.

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