Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Last active September 11, 2018 22:18
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 zackkatz/edbd4713afa49e550a9b to your computer and use it in GitHub Desktop.
Save zackkatz/edbd4713afa49e550a9b to your computer and use it in GitHub Desktop.
GravityView - Modify the text displayed when there are no results
<?php
add_filter( 'gravityview/template/text/no_entries', 'modify_gravityview_no_entries_text', 10, 3 );
/**
* Modify the text displayed when there are no entries. (Requires GravityView 2.0 or newer)
*
* Place this code (after <?php) at the bottom of your theme's functions.php file to enable it
*
* @param string $existing_text The existing "No Entries" text
* @param bool $is_search Is the current page a search result, or just a multiple entries screen?
* @param \GV\Template_Context $context The context.
*/
function modify_gravityview_no_entries_text( $existing_text, $is_search = false, $context = null ) {
if( $is_search ) {
$return = 'Your search came up empty! [Use your own new search text]';
} else {
$return = "There just aren't any results! [Use your own text]";
}
return $return;
}
@zackkatz
Copy link
Author

@mammothreach @m-e-h Please see this patch that fixes the search state: GravityKit/GravityView@a621cf2

Although I doubt this was the issue back in April 2016…hopefully with this latest fix, it will work properly for both of you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment