First, I'm assuming by "pesto" you mean "Pesto alla Genovese", given your question about pine nuts.
Basil, pine nuts, garlic, olive oil, and cheese is a delicious combination, but it's only one of many "pestos" (peste, actually), since pesto refers in general to any sauce which is made from crushed or pureed ingredients.
Mix and match to your heart's content.
Walnuts are actually a traditional alternative to pine nuts for Pesto alla Genovese; pine nuts have always been scarce, even in early-20th-century Italy.
As a caution, though, you need to get good, fresh walnuts and make sure to get all of the skin off the nuts, or the pesto will taste bitter and rancid.
Almonds could also work, although I'd think they'd be rather bland.
The herb pastes which traditionally have crushed almonds -- such as Romanesco sauce -- include some hot pepper.
Again, freshness and getting the skin off is important.
I'd think sunflower seeds would be kind of odd and oily, but you don't know until you try.
If you do, post a comment to let us know!
cooking.stackexchange.com/users/7180/FuzzyChef
Of course they would be appropriate, the taste wouldn't be the same though.
Have done a bit of experimenting with pesto.
Have used pistachios instead of pine nuts.
Parsley instead of basil is good too.
Expect that many of the green fresh herbs would make interesting pesto.
From Wikipedia : The name is the contracted past participle of the Genoese word pestâ
(Italian: pestare ), which means to pound, to crush , in reference to the original method of preparation, with marble mortar and wooden pestle.
I vary the proportions of herb/olive oil/garlic/nuts to taste as I make it.
Fun to mess around with when the new herbs are in.
Have always wanted to make pesto with tarragon, haven't though.
Have fun.
cooking.stackexchange.com/users/7092/Frankie
To my personal taste, you could even go without nuts completely and still have a great sauce.
Walnuts and almonds are absolutely ok: there are many forms of pesto (the most famous being of course the Genovese), and they employ a variety of herbs and nuts.
Pesto alla trapanese (named after the city of Trapani, in Sicily), for instance, uses almonds and includes tomatoes.
Pesto alle noci (noci means walnuts), another great sauce, is made with walnuts and celery.
A quick check on google tells me that pesto with sunflower seeds or pumpkin seeds is not unheard of, lots of recipes are available.
Others
I know of: pesto with arugula, pesto with green beans and potatoes and probably many other obscure variants.
Another option, but it depends greatly on your physical location, is to just collect pinecones by yourself - time consuming, but could make for a nice sunday activity (it certainly did for me when I was a kid)
cooking.stackexchange.com/users/1766/Agos
this question has also been asked here
What is a good pine nut substitute for pesto?
although with a different focus (his problem is not money but allergy).
Walnuts would probably taste good, but it is not Pesto alla Genovese if there are no pine nuts.
cooking.stackexchange.com/users/4558/Walter A. Aprile
Cashews are the simplest replacement, many people don't even notice the difference Commercially Cashews are used in many packaged products sold as Pesto or Pesto + something (roasted peppers, olives, sun-dried tomatoes etc.).
It is usually a filler to make up for a low pine nut percentage For home made pesto it is a bit more obvious unless your really processes it down to a smooth paste.
I personally like my pesto
very chunky
so don't like using cashews
cooking.stackexchange.com/users/3203/TFD
by all means use walnuts in pesto sauce.
As earlier posts have recommended, choose walnuts that are fresh, in other words, very pale in colour.
Darker walnuts are bitter.
If you can shell them, so much the better.
I also use lemon juice in my pesto.
And use a hand blender so that the sauce is grainy rather than pureed.
Walnuts are great in any sauce, try roasted egg-plant, tomato paste, garlic and walnuts, all blended.
Mmmm.
cooking.stackexchange.com/users/10249/duane
I use almonds frequently as my husband detests the taste of pine nuts (and can detect them in things at 40 paces).
I prefer to use raw ones; make sure to blanch them so you don't have the skins in there.
While Walnuts are common, they have a stronger flavor.
I've converted several friends to "almond pesto".
cooking.stackexchange.com/users/7232/Ann MacDonald
There are many Pesto variants out there.
It's basically a matter of taste.
See, for example, recipe and suggested variations here : A common change to the recipe is to replace some or all of the pine nuts with sunflower seeds, walnuts, pistachios or almonds.
The pine nuts can be replaced with an equal quantity of sun-dried tomatoes.
You may change the taste by changing the base of the pesto from basil to other easily obtained herbs/vegetables.
Some variations include using cilantro (coriander, for a more aromatic taste) or spinach (more "bang for your buck", as spinach is much cheaper than basil, yet still has its own distinct flavor).
cooking.stackexchange.com/users/6668/Itamar
Possible Duplicate:  What is a good pine nut substitute for pesto?     Pine nuts are very expensive here. I'm wondering if I can substitute any of the following:   Walnuts  Sunflower seeds  Almonds   Would any of these be appropriate in a pesto sauce?
Can I replace pine nuts with other nuts in a pesto sauce recipe?
cooking.stackexchange.com
<substitutions><italian-cuisine><nuts>
cooking.stackexchange.com/questions/17633
cooking.stackexchange.com/users/6194/lamwaiman1988
Fresh and pale walnuts are a common replacement in Italian pesto, although they do have a stronger flavour. Almonds may be a bit tasteless, but they are used with tomatoes in Pesto alla trapanese. Cashews are commonly used in commercial pesto, and pistachios or sunflower seeds are other options. Some people might actually prefer pesto without nuts or seeds at all. You could use walnuts, almonds, pistachios, cashews or sunflower seeds.
Walnuts are a good substitution but should be fresh. Almonds are a bit bland but are a possibility in pesto. Cashews are a good replacement. Pistachios are a good choice. Use sunflower seeds instead. You could remove nuts entirely and the sauce would be fine.