Arduino Wifi Shield together with LCD Display Shield

The examples page on Arduino.cc of LCD's show that the display needs to use digital pins 5, 4, 3 and 2 for data.

You are interpreting the example incorrectly because the example was not adequately explained.

The LiquidCrystal library can use any available Arduino I/O pin for any of the six LCD signals. The example just happens to use pins 5, 4, 3, and 2 for data (as well as 12 and 11 for RS and E) but that was an arbitrary choice. All you have to do is match up the LiquidCrystal lcd(. . . ); statement to match your connections. Two additional comments in the example would have illustrated this quite well.

// initialize the library with the numbers of the interface pins
// LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);        // put your pin numbers here

Edit: If you are using an LCD shield then the situation is a bit different. In this case the pin numbers are fixed because the designer of the shield has chosen which Arduino I/O pins to use. The choice was arbitrary when he chose the pins but once the shield is manufactured then the LiquidCrystal lcd(. . . ); statement must match that design.

Don