The Ising model in a Bak–Tang–Wiesenfeld sandpile