If Category has no posts display text
-
I have some code that spits out posts if it is in a certain category, if there are no posts in that category then I want it to spit out text that says “There are no Workshops at this time.”
<?php $catquery = new WP_Query( 'cat=2&posts_per_page=100&order=ASC' ); while($catquery->have_posts()) : $catquery->the_post(); ?> <b><a href="https://artspacelansdowne.com/workshops/#<?php the_ID(); ?>"><?php the_title(); ?></a></b><?php the_meta(); ?> <?php endwhile; ?>
My website is https://artspacelansdowne.com/
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘If Category has no posts display text’ is closed to new replies.