From 651bc192e8fa59054a3b6fab8cb1b693711054cc Mon Sep 17 00:00:00 2001 From: Bearded Avenger Date: Thu, 18 Jun 2015 18:47:34 -0500 Subject: [PATCH] fix target="" attribute not showing all entries --- public/assets/js/wp-live-search.js | 8 +++++--- public/includes/class.shortcode.php | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/public/assets/js/wp-live-search.js b/public/assets/js/wp-live-search.js index ecefe40..c4655ca 100644 --- a/public/assets/js/wp-live-search.js +++ b/public/assets/js/wp-live-search.js @@ -5,8 +5,9 @@ var backboneTemplate = $('#wpls--tmpl') , itemTemplate = _.template( backboneTemplate.html() ) , posts = new wp.api.collections.Posts() + , main = '#wpls' , postList = '#wpls--post-list' - , postList = $( postList ).data('target') ? $( postList ).data('target') : postList + , postList = $( main ).data('target') ? $( main ).data('target') : postList , results = '#wpls--results' , loader = '#wpls--loading' , input = '#wpls--input' @@ -20,7 +21,6 @@ , api = WP_API_Settings.root , timer - $( input ).on('keyup keypress', function ( e ) { // clear the previous timer @@ -32,7 +32,7 @@ , valEqual = val == $(that).val() , notEmpty = '' !== val , type = $(this).data('object-type') - , total = $(postList).data('number') + , total = $( main ).data('number') , url = api+'/'+type+'filter[s]='+val+'&filter[posts_per_page]='+total // 600ms delay so we dont exectute excessively @@ -64,6 +64,8 @@ // make the search request $.getJSON( url, function( response ) { + console.log(response) + // remove current list of posts $(postList).children().remove() diff --git a/public/includes/class.shortcode.php b/public/includes/class.shortcode.php index 4e8986f..304ad8a 100644 --- a/public/includes/class.shortcode.php +++ b/public/includes/class.shortcode.php @@ -42,7 +42,7 @@ public function shortcode( $atts, $content = null ) { ob_start(); ?> -
+
>
@@ -54,7 +54,7 @@ public function shortcode( $atts, $content = null ) {
-
    >
+