diff --git a/zoninator.php b/zoninator.php index 967b1cf..e2dce56 100644 --- a/zoninator.php +++ b/zoninator.php @@ -687,7 +687,7 @@ function zone_admin_recent_posts_dropdown( $zone_id ) { function zone_admin_search_form() { ?>
- +

@@ -832,6 +832,17 @@ function ajax_search_posts() { $limit = $this->posts_per_page; $exclude = (array) $this->_get_request_var( 'exclude', array(), 'absint' ); + if ( is_numeric( $q ) ) { + $story_id = intval( $q ); + $title = ! empty( $story_id ) && ! empty( get_the_title( $story_id ) ) ? get_the_title( $story_id ) : ''; + $stripped_posts[] = array( + 'post_id' => $story_id, + 'title' => ! empty( $title ) ? $title : __( '(no title)', 'zoninator' ), + 'date' => get_the_time( get_option( 'date_format' ), $story_id ), + 'post_type' => 'post', + 'post_status' => 'publish', + ); + } else { $args = apply_filters( 'zoninator_search_args', array( 's' => $q, 'post__not_in' => $exclude, @@ -865,14 +876,14 @@ function ajax_search_posts() { foreach( $query->posts as $post ) { $stripped_posts[] = apply_filters( 'zoninator_search_results_post', array( - 'title' => ! empty( $post->post_title ) ? $post->post_title : __( '(no title)', 'zoninator' ), + 'title' => ! empty( $post->ID ) ? get_the_title( $post->ID ) : __( '(no title)', 'zoninator' ), 'post_id' => $post->ID, 'date' => get_the_time( get_option( 'date_format' ), $post ), 'post_type' => $post->post_type, 'post_status' => $post->post_status, ), $post ); } - + } echo json_encode( $stripped_posts ); exit; }