We use semiclassical Hamiltonian optics to investigate the propagation of light rays through two-dimensional photonic crystals when slow spatial modulation of the lattice parameters induces mixed stable-chaotic ray dynamics. This modulation changes both the shape and frequency range of the allowed frequency bands, thereby bending the resulting semiclassical ray trajectories and confining them within particular regions of the crystal. The curved boundaries of these regions, combined with the bending of the orbits themselves, creates a hierarchy of stable and unstable chaotic trajectories in phase space. For certain lattice parameters and electromagnetic wave frequencies, islands of stable orbits act as a dynamical barrier, which separates the chaotic trajectories into two distinct regions of the crystal, thereby preventing the rays propagating through the structure. We show that changing the frequency of the light strongly affects the distribution of stable and unstable orbits in both real and phase space. This switches the dynamical barriers on and off and thus modulates the transmission of rays through the crystal. We propose microwave analogues of the photonic crystals as a route to the experimental study of the transport effects that we predict.