I need to be able to rewrite the permalink of custom post type posts to:
{post-id}.domain.com
and if {custom-field-1} of the post has a value, to:
{custom-field-1}.domain.com
Is it possible to do it with the wp_rewrite api, or in the post registering code some how?
BTW - the (awful) way i do it now is by:
Adding a wild card to my domain (*.domain.com).
On my index file i check with php what is the url and if it is a ubdomain or not.
if it is i get the subdomain part ("that-part".domain.com) and check if theres a post with this value in the specific custom field in my posts or is there a post with this id and if there is then is set the $post data to that post and include the right template file for that post type.
I know it's a bad way to that. but that's the only way i know how for now, hope you will help getting to a better solution.