Adding Control Voltage and Attenuation to Op-Amp Circuit
One approach is to  use an OTA; operational transconductance amplifiers like
LM13700 have a third input pin, that alters the gain of the amplifier.   If
one wishes, in addition to gain, an attenuator on the input signal, that's
just a good use for a second OTA (the LM13700 contains two OTAs, so it's not
much trouble or cost); gain can be greater or less than 1.
The gain-setting  input is
a current-sensing input, diode-clamped to the negative supply rail.
OTAs have some disadvantages; they aren't temperature-independent nor
entirely linear for large input signals, and input currents may be significant.
OTA output is a current source/sink, not a low-impedance voltage source
like ideal op amps, so a resistor to ground and follower (maybe just
the built-in Darlington follower) convert to a voltage source if that's important.