Show message when query has no posts
Answer I found the answer, thanks to a comment and after some digging myself: function dfib_jobs_shortcode( $atts ) { ob_start(); $query = new WP_Query( array( ‘post_type’ => ‘jobpost’, ‘posts_per_page’ => -1, ‘order’ => ‘ASC’, ‘orderby’ => ‘rand’, ) ); ?> <div class=”vacatures__wrapper”> <?php if ( $query->have_posts() ) { ?> <?php while ( $query->have_posts() ) : … Read more