Food allergies are chancy things. Sophisticated laboratory testing can analyze the antibodies in your system to determine not only which foods you might be allergic to, but which specific protein in that food. This is why allergy sufferers are sometimes triggered by one kind of nut, but not others. If you were allergic to walnuts, for example, you might want further testing before turning your back on all nuts.
Other Tree Nuts
If you've been diagnosed as allergic to walnuts specifically, but not other nuts, it is a straightforward matter to make substitutions. The nut closest to walnuts in texture and appearance is pecans, which are usually more expensive but can be substituted directly. Walnuts have a more delicate texture than most other nuts, so you may find it's necessary to chop other nuts coarsely if you're using them in a walnut recipe. It's not uncommon to be allergic to more than one kind of nut, so for safety's sake it's prudent to be tested for allergy to all the major nut varieties.
Peanuts are a possible substitute for walnuts in many recipes. They are not related to tree nuts at all, but are a legume related to beans and peas. That's why some people are allergic to nuts but not peanuts, while others are allergic to peanuts but not nuts. Halved or coarsely chopped peanuts can be substituted for walnuts in most recipes in identical quantities. Remember that peanuts have a strong flavor of their own, so they're not your best option in baked goods with a delicate flavor.
Like peanuts, the most common seeds for baking are unrelated to tree nuts and are considered a separate allergy. Larger seeds including pumpkin seeds and sunflower seeds can be used as direct replacements for whole walnuts or walnut pieces, while smaller seeds such as sesame seeds can replace crushed walnuts in some baking recipes. Pumpkin seeds have a mild flavor and a texture similar to walnuts, so they're a good choice in most cases.
There are many other ingredients that can add flavor or a contrasting texture to your foods. In some instances, breakfast cereal such as rice crisps or Grape Nuts can be used to provide a pleasant crunch and nutty flavor. In sweets and baked goods, you can get a similarly crunchy effect with butter caramel pieces, available from your bulk foods store. A more exotic option is cocoa nibs, small pieces of real cocoa beans. They have a distinct crunch and a chocolate flavor that can make a pleasant variation in your favorite recipe.