Elementor – A Weblog of Priyank Maniar https://priyank.rocks Articles on web development & mobile app development Wed, 12 Oct 2022 08:41:16 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 How to have a no records message in Elementor for an Archive page? https://priyank.rocks/how-to-have-a-no-records-message-in-elementor-for-an-archive-page/ Wed, 12 Oct 2022 08:40:52 +0000 https://priyank.rocks/?p=9189
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>';
        }

    }
});
]]>