moved some PhP

Also fixed the thing on the Pages sidebar