Blazars are a class of active galactic nuclei which host relativistic jets oriented close to the observer's line of sight. Blazars have very complex variability properties. Flares, namely flux variations around the mean value with a well-defined shape and duration, are one of the identifying properties of the blazar phenomenon. Blazars are known to exhibit multi-wavelength flares, but also "orphan" flares, namely flux changes that appear only in a specific energy range. Various models, sometimes at odds with each other, have been proposed to explain specific flares even for a single source, and cannot be synthesized into a coherent picture. In this paper, we propose a unified model for explaining orphan and multi-wavelength flares from blazars in a common framework. We assume that the blazar emission during a flare consists of two components: (i) a quasi-stable component that arises from the superposition of numerous but comparatively weak dissipation zones along the jet, forming the background (low-state) emission of the blazar, and (ii) a transient component, which is responsible for the sudden enhancement of the blazar flux, forming at a random distance along the jet by a strong energy dissipation event. Whether a multiwavelength or orphan flare is emitted depends on the distance from the base of the jet where the dissipation occurs. Generally speaking, if the dissipation occurs at a small/large distance from the supermassive black hole, the inverse Compton/synchrotron radiation dominates and an orphan -ray/optical flare tends to appear. On the other hand, we may expect a multi-wavelength flare if the dissipation occurs at a intermediate distance. We show that the model can successfully describe the spectral energy distribution of different flares from the flat spectrum radio quasar 3C 279 and the BL Lac object PKS 2155-304.