Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created Jan 4, 2019
Embed
What would you like to do?
<?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