Wordpress 3.0 jQuery phần 9

Như bạn thấy, bạn đang trở lại rất nhiều dữ liệu để làm việc với! Một lần nữa, nó trả tiền để khai thác thông qua các API và xem những gì có sẵn để tận dụng, bạn cũng có thể có những giờ vui vẻ chỉ thử nghiệm với việc hiển thị tất cả các mặt hàng khác nhau có sẵn trong nguồn cấp dữ liệu JSON. | Simpo PDF Merge and Split Unregistered Version - http AJAX with jQuery and WordPress As you can see you re given back a lot of data to work with Again it pays to dig through the API and see what s available to leverage you can also have hours of fun just experimenting with displaying all of the various items available in the JSoN feed Using getJSON with Flickr The client likes it And of course they now think the home page is now too text heavy . What about adding in the six latest images from Flickr images tagged wordpress theme in the sidebar That should balance it out. Fortunately this is not a problem either. Again your first stop should be the Flickr API documentation http services api . But we ll go ahead and get started again creating a little space in the home page s sidebar for the images jQuery .home .append div class flickr h2 Latest Flickr h2 div Here with their public photo stream method URL . var flickrURL http services feeds photos_public. gne tags wordpress themes tagmode all format json jsoncallback And now we can set up our getJSON call . flickrURL function flickrImgs jQuery .flickr li .each function i jQuery this .html img src i . width 100 height 100 242 Simpo PDF Merge and Split Unregistered Version - http Chapter 7 The Flickr JSON string returns an array called items that offers all sorts of data. You ll notice that it s a little different when targeting the information we want compared to the twitter API. By pulling the url to a thumbnail we re able to create a quick list of images. It looks like this under Our Tweets Other popular services that offer APIs with JSON format The fun doesn t have to stop there Now that you re familiar with using .getJSON your world is open to implement all sorts of custom cross-site mashups and solutions in your WordPress sites. Understanding JSON and the .getJSON function also makes you more adept at .

TỪ KHÓA LIÊN QUAN