subcategory plugin update, sub_path and sub_url

As per my comment on #280 this should be the same implementation without the duplicate code. 

@vpiotr would you mind testing this to make sure it works as expected?

Is this the proper way to do this? I mean with the pull requests. I don't want to stomp on vpiotr's contribution.