From 56a3af544b57450f61947c1cfd5e3b1a057216de Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 23 Sep 2015 21:36:09 +1000 Subject: [PATCH] Add get posts API function --- includes/sp-api-functions.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/sp-api-functions.php b/includes/sp-api-functions.php index 22927073..b2ab402d 100644 --- a/includes/sp-api-functions.php +++ b/includes/sp-api-functions.php @@ -25,6 +25,15 @@ function sp_the_time( $post = 0 ) { echo sp_get_time( $post ); } +function sp_get_posts( $post_type = 'post', $args = array() ) { + $args = array_merge( array( + 'post_type' => $post_type, + 'numberposts' => -1, + 'posts_per_page' => -1, + ), $args ); + return get_posts( $args ); +} + /* * Event functions */