Custom template support

The code in `admin` directory is basically a copy of original WordPress code
modified for our case.