WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
give me an example (3 posts)

  1. jobhesk
    Member
    Posted 1 year ago #

    I am trying to code

    I have read from http://davidwalsh.name/wordpress-json-plugin
    and I tried to use the user-friendly permalinks to run a json..

    I have a custom post type called hkm_aaa
    I want to get the data from a specific custom post type and from its post_id

    how can i do that with this json API?

    http://wordpress.org/extend/plugins/json-api/

  2. jobhesk
    Member
    Posted 1 year ago #

    this is what i got so far..

    jQuery.fn.hkmtype_event_indexpage = function() {
    	this.html("");
    	var Dis = this;
    	var url = wsm_base_obj.domainbasejson + "get_recent_posts&post_type=hkmtype_event&order_by=date&order=desc&count=4";
    	jQuery.ajax(url).done(function(jsonlocal) {
    		//eval("var o=" + jsonlocal + ";");
    		if (jsonlocal.status != "ok") {
    			alert("request error... line 75");
    			return false;
    		}
    		var data = jsonlocal.posts;
    		//alert(data.length);
    		for (var i = 0; i < data.length; i++) {
    			h = "<div class=\"item even_poster line\">" + data[i]["title_plain"] + "</div>";
    			//alert(data[i]["title_plain"]);
    			Dis.append(h).click(function() {
    					//alert("this is go");
    			//loop it all
    			});
    		}
    	});
  3. jobhesk
    Member
    Posted 1 year ago #

    this is how I get started..

    get_recent_posts
    &post_type=hkmtype_event
    &order_by=date
    &order=desc&count=4

    now what can i do to include the feature image url into the json object??

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic