Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created January 4, 2019 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/8918295d66acd3ac8d144f99446fb246 to your computer and use it in GitHub Desktop.
Save billerickson/8918295d66acd3ac8d144f99446fb246 to your computer and use it in GitHub Desktop.
<?php
/**
* Display Posts, search form if no results
* @see https://displayposts.com/2019/01/04/display-search-form-if-no-results/
*/
function be_dps_no_results_search( $message ) {
$message = '<div class="display-posts-listing no-results">';
$message .= '<p>It seems we can’t find what you’re looking for. Perhaps searching can help.</p>';
$message .= get_search_form( false );
$message .= '</div>';
return $message;
}
add_filter( 'display_posts_shortcode_no_results', 'be_dps_no_results_search' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment