I wish to use the REST API of wordpress to construct a brand new model of a customized theme. I can get the json response of a specific class, however I have to discover a approach to get hold of additionally the featured picture or the second put up thumbnail registered utilizing a plugin, so I can use them within the structure. Is that this doable with out utilizing a plugin?
right here is the code I am utilizing for testing:
<script>
(perform($){
$(doc).prepared(perform(){
$.getJSON('https://localhost/wordpress/wp-json/wp/v2/posts?category_name=portfolio&per_page=50&_embed', perform(response){
console.log(response);
$.every(response, perform(i){
console.log(response[i]._embedded['wp:featuredmedia'][0].source_url);
});
});
});
}(jQuery));
</script>
the final a part of the console log is not going to work however the [0].source_url
is the data I would like for every JSON put up offered.