Timeline for Nested custom post types with permalinks
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 29, 2013 at 14:15 | comment | added | Rachel Carden | @Segfault You can use get_terms(), if you're using a CPT-onomy, or get_posts() to retrieve the post names/slugs. | |
| May 29, 2013 at 14:05 | comment | added | Rachel Carden | @Segfault You will have to retrieve all of the author slugs so you can hard code them into the rewrite rule(s): foreach( $author_slugs as $author_slug ) { add_rewrite_rule( '^authors/' . $author_slug . '/([^/]*)/([^/]*)/?','index.php?authors=' . $author_slug . '&chapters=$matches[2]','top' ); add_rewrite_rule( '^authors/' . $author_slug . '/([^/]*)/?','index.php?authors=' . $author_slug . '&books=$matches[1]','top' ); } | |
| May 29, 2013 at 13:58 | comment | added | Segfault | @RachelCarden What do you do when two books have the same title but different authors? There will be a collision in the rewritten URL! How do you solve this? | |
| Aug 14, 2012 at 14:04 | comment | added | Rachel Carden | I have a feeling you might come across some obstacles as your "library" grows but I already have some code in mind so, if you do, just let me know. | |
| Aug 14, 2012 at 9:50 | comment | added | Dalton Rooney | This works perfectly, thank you! I feel like I just learned so much. The CPT-onomies plugin is really cool, too. wordpress.org/extend/plugins/cpt-onomies | |
| Aug 14, 2012 at 9:47 | history | bounty awarded | Dalton Rooney | ||
| Aug 14, 2012 at 9:47 | vote | accept | Dalton Rooney | ||
| Aug 14, 2012 at 4:29 | history | answered | Rachel Carden | CC BY-SA 3.0 |