rest api - Custom post type archive page - Posts overview - with one modal for multiple posts?

I will try to explain what I am trying to accomplish. I have created a post type "cars" and a file archive-car

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信