Gravity and massless particles?

I'm sure this is a very newbie-level question, but how is it that massless particles and light are affected by gravity? I've been reading about the 'ghost condensate' theory, and the latest article in New Scientist that says these massless 'ghost' particles should have been sucked up by black holes a long time ago and so they probably don't exist anymore if they ever did. Bearing in mind I haven't got a clue about the intricacies of the ghost condensate idea beyond what I read in magazines, and that I've obviously got my idea of how gravity works wrong because light can't escape a black hole either, I've been confused on the most primal level possible with this.

We ought to have the answer to this question in a FAQ, but we don't, so I'll answer. In general relativity the curved geometry, which is what gravity is, is caused by momentum, energy and the rate they are changing, not by mass by itself Massless particles have momentum and energy even though they don't have mass, so they curve spacetime geometry, and thus they gravitate.

I'm sure this is a very newbie-level question, but how is it that massless particles and light are affected by gravity?

All matter has a non-zero and finite gravitational mass. Some exceptions are things which the pressure is negative and so high as to cancel the gravitational effect of the mass. but you're thinking of proper mass (aka rest mass), which is zero for some matter such as photons.

I'm sure this is a very newbie-level question, but how is it that massless particles and light are affected by gravity?

It's not a newbie question. You would have to understand at least the basics of general relativity to know the answer to that question. Any free particle, massless or not, travels on a path through spacetime that in a certain sense is the straightest possible path. In technical terms, the particle's world line is a geodesic. The presence of a heavy object like a star curves spacetime, and the result is that the "straightest possible" paths in spacetime are not straight lines in space.

It's not a newbie question. You would have to understand at least the basics of general relativity to know the answer to that question. Any free particle, massless or not, travels on a path through spacetime that in a certain sense is the straightest possible path. In technical terms, the particle's world line is a geodesic. The presence of a heavy object like a star curves spacetime, and the result is that the "straightest possible" paths in spacetime are not straight lines in space.

One does not have to have a curved spacetime for a beam of light to be deflected. A uniform gravitational field (no spacetime curvature) will deflect light too. In fact this was the field that Einstein first used in his very first article (1907) on the equivalence principle.