The Wien displacement law (and Planck's law, which fixes the "ultraviolet catastrophe" issue) describe thermal radiation emitted by bodies in thermal equilibrium, not the discrete spectra which result from electronic transitions. Unlike atomic and molecular spectra, thermal radiation is continuous.
How is thermal radiation not a result of electron transitions?
For a fairly intuitive picture, consider photons which are generated by fusion reactions within the sun. For a given reaction - say, $p+p+e^- \rightarrow {^2_1}D + \nu_e + \gamma+\gamma$, the first stage of the proton-proton fusion chain) - two photons whose energies follow a non-Planckian distribution. Those photons then make a very long journey from the core to the surface of the sun. In the process, they scatter off of electrons and ions, both giving and taking energy in random amounts (depending on what they scatter from and at what angle), before finally escaping from the photosphere.
Through this energy exchange, the photon gas rattling around inside the sun comes to thermal equilibrium with the surrounding charged particles (of course, this equilibrium is local, since the temperature within the sun varies considerably with location). The photon energy distribution progresses irreversibly in the direction of increasing entropy, and the distribution with maximal entropy is the Planck distribution. Therefore, if a photon gas is in thermal equilibrium with its surroundings, then its energy distribution is given by the Planck law.
The same principle holds for thermal radiation emitted by any object, not just the sun. Photons scattering around within the object come to equilibrium with its constituent particles before being emitted with a continuous (or approximately continuous) spread of energies. When you see light which has a discrete set of frequencies (such as light emitted from a gas discharge lamp, then that light is not at thermal equilibrium.