I have a wall on one side with trim molding at baseboard and opposite end is the wooden banister. What type of gate can I attach. The drywall is not holding the screws in place and we we frequently open and close the gate. I have regalo gate that I re-purposed but it keeps falling off the drywall. The stud is a little fruther away from where I want the gate on the wall, if I fix it to the stud in the drywall, the gate would be at an angle to the wooden banister.
Could you attach a board to the wall, that spans the distance between the stud, and your ideal hinge location for the baby gate? For an example of what I'm talking about-- as well as plans for a cool parallelogram baby gate-- see the following: http://woodgears.ca/home/baby_gate.html (Note I am not talking about the gate at the top of the stairs, that you see at the top of the linked page, but rather the gate at the bottom of the stairs.)
There are safety gates made specifically for this configuration. See, for example, this one on amazon: Regalo Top of Stair Gate, White by Regalo http://www.amazon.com/dp/B003VNKLI4/ref=cm_sw_r_udp_awd_AUjItb1Q0882Z
I'm not endorsing it or recommending this particular one ... Just pointing out that there's a product line designed to meet this need.
I would attach a piece of wood to the drywall at the place you want it, and attach the gate to the wood.
You can make it wide enough to reach over to the stud, or leave it narrow (like a 1x4 board, 36 inches tall) and just put it in the place you want to anchor the gate.
There is only one reliable way that I have found to attach anything to drywall, which is using auger-type anchors:
These are available at any hardware or home-improvement store. I highly recommend the metal ones. The plastic augers are acceptable, but the metal ones are more durable.
Any other plastic drywall anchor is a waste of time and will not hold up to much weight, flexing, or stress.
They are quite strong. I attached an equipment rack straight to drywall (no stud connections) with 8 of these, and did chin-ups on it (weighing 200 pounds). It did not move at all.
For a baby gate, I would use the 1x4 board held into the drywall by 6 of these augers, in a zig-zag pattern with 3 on each side. Drill 6 pilot holes (1/8 inch drill bit) through the wood into the drywall (that way you know your holes will all line up). Put the augers into the drywall in those holes. Enlarge the holes in the wood so the screw slips through (you don't want the screw threads grabbing the wood; you only want them grabbing the augers), and then screw the wood to the augers. Then attach the gate to the wood.
Alternatively, if you use a wider piece of wood to reach the stud: either make the wood wide enough to span from one stud to the next (probably 16 inches), or else use these augers on the non-stud side of the wood.