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(); ?> -