My Mom used to knit seasonal baby hats for friends and charity so I decided to make pumpkin hats.
I used orange and green cotton yarn and normal toddler hat pattern. Circular needles allowed it to be garter stitch and then just switch to green toward the top. For the stem I used icord stitch and attached it when finished.
If you don't want it to roll use a 1 inch ribbing around the bottom. Although if you don't know the size of the child's head then the roll can be helpful.
This one has a ribbed edge and not as much green for the stem.
Here is a pic of my little guy wearing one!