modified code for template custom headers in each post 17