alternating classes on wp_list_pages

Consider this a complement to toscho’s solution.

I believe that …

$this->alternate = ($this->alternate != 'background_1') ? 'background_1' : 'background_2';
$css_class[] = $this->alternate;

… will do what you want.

The difference is that toscho’s solution, using the static keyword, will make that variable static for any instantiation of this walker– that is, all instances will share the same value. If you instantiate two walkers the second will pick up where the last left off. That may be what you want, or it may not be. Using $this will limit it to the one instance of the walker only.