Using the following snippet will let you have hierarchical sidebar navigation in WordPress.