Every resonator amplifies just certain frequencies while it inhibits all others.
This is true only for very simple resonators. The shape of the guitar body is such that it has a different size at different angles. This corresponds to different resonant frequencies. In addition, the top has a supporting bracing that is very different on different models and is critical for the sound.
Furthermore, a guitar is nor necessarily a resonator, but a converter of the mechanical energy of the strings to the acoustic energy of the air. You are absolutely correct that a strong resonance at a certain frequency would help this frequency at the expense of other frequencies and thus would be detrimental for the sound of a broad spectrum instrument. Therefore the objective of the guitar design (counter intuitively at first) is not to create, but to avoid strong resonances.
There are two parts in a guitar relevant here. One is the top made either of softer ceder for a warmer sound or harder spruce for a brighter sound (sometimes a two-layer top has both). The purpose of the top is to move air with its large area thus converting the mechanical energy of the strings to the acoustical energy of the sound. However, the top radiates both forward and back, plus the sound radiated back is out of phase with the sound radiated forward.
The second important part is the body. Historically the most popular material for the body had been the Brazilian rosewood before Brazil prohibited exporting it. Similar results are achieved with the rosewood from India, Madagascar, and other areas. Mahogany is also popular along with other wood species.
The main purpose of the body is to reflect forward (through the sound hole) the sound emitted back by the top and do it while inverting the phase, so that the sound emitted by the sound hole would be in phase with the sound emitted forward by the desk. Thus the guitar body is not a resonator, but a phase inverter very similar to common speakers with a PORT. Phase inversion depends on the internal dimensions of the body and is a compromise in order to optimize all frequencies equally. Although this is more important for lower frequencies (again, similarly to speakers).
The materials, shape, and bracing have been perfected by generations of guitar makers resulting in specific sound signatures. One example is the 1A model with a ceder top by Jose Romirez. Its sound is mesmerizing.