Skip to content

Instantly share code, notes, and snippets.

@sambody
Forked from billerickson/functions.php
Created June 26, 2013 18:05
Show Gist options
  • Save sambody/5869806 to your computer and use it in GitHub Desktop.
Save sambody/5869806 to your computer and use it in GitHub Desktop.
WP: Display message if no results in category
<?php
add_filter( 'display_posts_shortcode_no_results', 'be_no_results' );
/**
* Display Posts Shortcode - Display message if no results
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/display-posts-shortcode-no-results
*
* @param string $output, default is empty
* @return string $output
*/
function be_no_results( $output ) {
$output = '<p>Sorry, there are currently no posts in this category.</p>';
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment