Please correct me if I am wrong.
You are.
Although I am not sure, I guess the setup function is not being called where connection to the router is made.
I think it is more likely that the setup() function is called, but that it is not initializing the wifi shield correctly. Add an LED, with appropriate resistor, and some code to setup() and flash the LED in setup(), to see when that happens.