Add BeforePageDisplay hook