Skip to main content
Elementor

How to have a no records message in Elementor for an Archive page?

By October 12, 2022No Comments
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * @source: https://github.com/elementor/elementor/issues/7624#issuecomment-645129375
 */

add_action('elementor/query/query_results', function($query) {
    $total = $query->found_posts;
    if ($total == 0) {

        if ( $query->get("post_type") == "chapter" ) {
            echo '<h4>Sorry! no chapters found.</h4>';
        }

    }
});