I will try to explain what I am trying to accomplish. I have created a post type "cars" and a file archive-cars.php
When I visit this page slug it displays all the posts. I have created a Javascript modal which I would like to display for each CP post type.
But, as you guys know you don't want to output the same HTML markup for each post over and over again. Which will result in a very large page?
I have one HTML markup for the modal and I want to use this same markup for each post when you toggle the modal.
I have tried with wp-json to fetch the data using Javascript. The dilemma is that I don't know how to dynamically load the post data on click with Javascript so that the markup stays clean in the long term.
Can someone tell me how I can do this with wp-json REST API and an archive page? do you guys have any example?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744935697a4602006.html
评论列表(0条)