Every so often, just the right combination of conditions and events occur to create an unbelievable event- in this case an F-18 passing through the sound barrier. Not only were the water vapor, density and temperature just right, but there just happened to be a camera in the vicinity to capture the moment. The F-18 is actually in transonic flight, with normal shock waves emanating from behind the canopy and across the wings and fuselage. The condition will last for only an instant, and once supersonic flow exists completely around the aircraft, sharp-angled sonic cones replace the normal shock waves. The odds of getting a shot like this are staggering.
A similar photo, this time of an F-4 Phantom breaking the sound barrier.
And a couple of movies that show similar effects, one of an F-14 and one of an F-18.
The F-14 flyby (the better of the two)
The F-18 flyby