In this tutorial, we’ll look at different ways to modify the ‘Sorry, no posts matched your criteria’ text.
This text is displayed when using the search built into WordPress or when no posts are assigned to categories or tags.
We’ll need to use a filter hook to change this text as its already built into the core Genesis files.
Here’s the filter for changing the no post text:
Default value: __(‘Sorry, no posts matched your criteria.’, ‘genesis’)
Applied to the no post text which is returned when a query is made with no results in the genesis_do_noposts function.
Like the Genesis action hooks, you’ll also find a list of all filter hooks for Genesis which you can use to modify existing add_action functions using Genesis action hooks.
Here’s the hook which is used to generate the default no posts text.
Filter Hook Code
There’s different ways to change the no post text.
This code will enable you to add style to both the title and text. You could even change the code if you want to add even more styling.
Here’s some sample CSS code you can use to style your no post text and even hide it altogether.
You’ll find the code in the genesis > lib > structure > post.php file starting on line 223.
Click To Enlarge Image