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

url rewriting - How to create custom URLs for Custom Post Type sub sections?

programmeradmin2浏览0评论

Not sure how to ask this, because I'm not exactly sure what I'm asking.

I'm looking to use custom URLs (using rewrite rules maybe?) to create 'tabs' for a Custom Post Type. In the past I've used things like a GET session variable to determine what tab the user is on, or JavaScript. I would really prefer to keep it on it's own logical page with a URL to reflect that.

A very basic look of the tabs would be:

HOME | UPDATES | CONTRIBUTORS | WALL

For example if we're on the CPT of Charity's sub page of Updates: http://siteroot/charity/updates

Not sure how to ask this, because I'm not exactly sure what I'm asking.

I'm looking to use custom URLs (using rewrite rules maybe?) to create 'tabs' for a Custom Post Type. In the past I've used things like a GET session variable to determine what tab the user is on, or JavaScript. I would really prefer to keep it on it's own logical page with a URL to reflect that.

A very basic look of the tabs would be:

HOME | UPDATES | CONTRIBUTORS | WALL

For example if we're on the CPT of Charity's sub page of Updates: http://siteroot/charity/updates

Share Improve this question asked Jul 6, 2012 at 18:01 TyrunTyrun 1028 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Create an end point for the permalinks. See example.

Then you can even be more granular and use updates/2012, updates/2013 and so on.

Recommended reading:

  • Codex: add_rewrite_endpoint()
  • A (Mostly) Complete Guide to the WordPress Rewrite API
发布评论

评论列表(0)

  1. 暂无评论