最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论