The Northern cardinal is a lover of seeds. If you can put out sunflower seeds, white milo, or even safflower seeds, they will flock to your yard. However, there are other things they like, depending on what kind of a cardinal you want to attract. Berries are usually a safe bet across all species of cardinals, as are cracked corn and crushed peanuts. This is because cardinals, more often than not, have thicker beaks. This makes it more efficient for them to crack nuts and such, so smaller pieces of peanuts (because, wow, peanuts are large) and larger nuts will be wonderful for them.
However, if you want to attract cardinals, there are a few things to avoid when you feed cardinals. Try not to use anything reflective, as this scares them off.