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

How can I use a custom template to load custom post type posts based on a post_meta value

programmeradmin0浏览0评论

I have a CPT which saves a location and and its slug into wp_postmeta table. The location is selected from a dropdown in CPT edit page and it is not a taxonomy.

Now I want to create a custom template which needs to understand the value I am passing through the URL such as .

The part himachal-pradesh is my location slug and I want to pull posts which has the same value in wp_postmeta table.

I have created a custom template and can use it to create a new page (), but it will actually have the location slug which is dynamic for each location.

What is the right way to achieve this?

发布评论

评论列表(0)

  1. 暂无评论