Speaker and headphone question

You need to get a headphone jack that switches when the plug is inserted. These are readily available. Internal contacts allow the circuit to go to the speaker when there is no plug; when the plug is inserted the speakers are disconnected and the headphones connected.