07967 325669 info@mootpoint.org

Divi is an excellent theme from Elegant Themes with a powerful visual editor built in. One of the many useful Divi modules which you can drop into your page is the Blog module, which displays a grid of recent posts, limited by category. However, if there are no posts in that particular category, the theme displays an ugly message: “No Results Found. The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.”

The simplest way to remove this message, is to override /wp-content/themes/Divi/includes/no-results.php by copying the file into your child theme at /wp-content/themes/your-divi-child-theme/includes/no-results.php. Edit this file and add a wrapper div to the error message:

<div class="entry">
	<!--If no results are found-->
	<div class="no-results">
		<h1><?php esc_html_e('No Results Found','Divi'); ?></h1>
		<p><?php esc_html_e('The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.','Divi'); ?></p>
	</div>
</div>
<!--End if no results are found-->

Now you can hide the message using CSS in your style.css by adding the following line:

/* Hide "no results" message on blog module */
.et_pb_blog_grid .no-results {
	display: none;
}

Make sure to include the et_pb_blog_grid class so that the message is only hidden on the blog module because the no-results.php template is also used on the general 404 page, and this message should be displayed.