No products found text

0.0/5
<?php
add_action('elementor/query/query_results', function($query) {
	$total = $query->found_posts; //Get number of found posts
	
	if($total !== 0) { //if different from 0, return
		return;
	}
        if ($query['post_type']== 'product') //You can change the post type to a custom one
        {
	        echo '<p>' No products have been found'.</p>'; // You can put a custom message in between the <p> and </p> tags.
         }
});

Comments and reviews

{{ reviewsTotal }} Review
{{ reviewsTotal }} Reviews
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}

Description

This snippets displays a given text when a query for a given post type doesn’t find any posts.

Author

Tags

This snippet is untagged