It all depends on the energy band structure of the solid. A given photon has a high probability of being absorbed if it matches some type of resonant transitions within the solid. Whether a material is transparent or opaque thus depends on what part of the spectrum you are interested in.
Take glass for an example. It is transparent in the visible, yet it is opaque in the infrared.
Claude.