From 55db7a1def3a18e0a2e6164711d7033887d1b9b4 Mon Sep 17 00:00:00 2001 From: Pete Nelson Date: Tue, 18 Apr 2017 14:44:16 -0500 Subject: [PATCH 1/2] added check for empty posts --- post-finder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/post-finder.php b/post-finder.php index 50a938b..e841a30 100644 --- a/post-finder.php +++ b/post-finder.php @@ -294,9 +294,11 @@ public static function render( $name, $value, $options = array() ) { ?> +

%d of %d maximum items', 'post_finder' ), intval( count( $posts ) ), intval( $options['limit'] ) ); ?> You'll need to remove an item from the list before you can add another.

+
From 6b74658918dd1f0f0794679ef1c6f618cfbb3476 Mon Sep 17 00:00:00 2001 From: Pete Nelson Date: Tue, 18 Apr 2017 14:48:29 -0500 Subject: [PATCH 2/2] display 'maximum items' even if posts is empty --- post-finder.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/post-finder.php b/post-finder.php index e841a30..a64185a 100644 --- a/post-finder.php +++ b/post-finder.php @@ -294,11 +294,9 @@ public static function render( $name, $value, $options = array() ) { ?> -

- %d of %d maximum items', 'post_finder' ), intval( count( $posts ) ), intval( $options['limit'] ) ); ?> You'll need to remove an item from the list before you can add another. + %d of %d maximum items', 'post_finder' ), intval( empty( $posts ) ? 0 : count( $posts ) ), intval( $options['limit'] ) ); ?> You'll need to remove an item from the list before you can add another.

-