Add before- and after- hooks to edit template