Load WordPress posts using JSON and enable search using jQuery

We’re going to load posts using JSON from a WordPress custom post type, assign the posts to a list inside a div and enable live search using jQuery.

Basic HTML page.
On page load, we’ll call a jQuery function, load_drummers_list() that loads the custom post types.

Here we’ll use the jQuery getJSON() function to retrieve the posts and populate the div with a class of drummers-list.
NOTE: The json rest api plugin needs to be installed first for this to work.

Once the posts are loaded, the user will be able to type in a partial or full name and the results will be filtered to show the results accordingly.

Facebooktwitterlinkedinmail

by Norm Euker