My mind has simply gone numb with this problem. I have created the following custom post types : Artists, Albums, Songs. Songs are children of Albums, Albums are children of Artists. I am trying to set up a navigation structure that shows this relationship, in the following format: http://www.example.com/artists/alicia-keys/albums/girl-on-fire/brand-new-me . ‘alicia-keys’ is a post name of type artists, ‘girl-on-fire’ is a post name for the post type albums & ‘brand-new-me’ is a post name for the post type Songs .
When someone shortens the url to say, ‘http//www.example.com/alicia-keys/albums’ it should display albums that belong to Alicia Keys and if you simply type ‘http://www.example.com/albums‘ it shows all albums from all artists.
I know solving the problem will involve using wordpress add_rewrite_rule() functionality and whatnot but my mind simply doesn’t understand how to implement it properly.I am hoping someone can give me pointers to achieve such a navigation structure using URL rewrite rules and any other relevant function.
Just a note: I am using Wp-types plugin to create the custom post types however, I strongly feel this problem is more of a WordPress challenge rather than one restricted to a specific plugin but nonetheless, I have also posted a similar question in their forum. If I get an answer there, I will also supply it here to help anyone else who might face such a problem in the future.
NOTE: Moved to wordpress stack exchange (should have been there in the first place) – https://wordpress.stackexchange.com/questions/167156/url-rewrite-and-navigation-structure-for-wordpress-custom-post-type