WordPress.org

Support

Support » Plugins and Hacks » JSON API » Advanced Custom Fields

Advanced Custom Fields

Viewing 1 replies (of 1 total)
  • Sorry it appeared to strip part of the code…

    function listPosts(data) {
      var output = '<form class="ui-filterable"><input id="searchposts" data-type="search"></form>';
    
      output += '<ul data-role="listview" data-filter="true" data-input="#searchposts">';
      $.each(data.posts, function(key, val) {
    
        var tempDiv = document.createElement("tempDiv");
        tempDiv.innerHTML = val.excerpt;
        $("a", tempDiv).remove();
        var excerpt = tempDiv.innerHTML;
    
        output += '<li>';
        output += '<a href="#blogpost" onclick = "showPost(' + val.id + ')">';
        output += (val.thumbnail) ?
          '<img src="' + val.thumbnail + '" alt="' + val.title + '">':
          '<img src="images/copy-logo.png" alt="iDrum">';
        output += '<h3>' + val.title + "</h3>";
        output += '<p>' + excerpt + "</p>";
        output += '</a>';
        output += '</li>';
      }); //go through each post
      output += "</ul>";
      $('#postlist').html(output);
    } //listPosts
Viewing 1 replies (of 1 total)
  • The topic ‘Advanced Custom Fields’ is closed to new replies.
Skip to toolbar