[Plugin: Get Posts] When Tag is Empty
-
Hi,
Thanks for the plugin! I’m using it to display contextually relevant posts on specific page using the shortcode in combination with the WordPress Text widget.
One thing I found was that if no posts were returned I ended up with an empty widget box. So in case it helps anyone else:
$posts = get_posts($args);Below I added:
if (empty($posts)) { $content = $content. "No related posts yet! <a href='blog/'>Take a look at some other blog posts</a>"; }Cheers,
Mat
The topic ‘[Plugin: Get Posts] When Tag is Empty’ is closed to new replies.