Infrared radiation (heat radiation, or thermal radiation) from the sun is of short wavelengths because of the high surface temperature of the sun (about 6000 degrees Celsius). The wavelngth of such infrared radiation is near to the red end of the visible light spectrum. It's property is close to that of visible light and will thus pass through glass similar to visible light does.
When this infrared raidation is absorbed by objects inside a greenhouse, the object emits its own infrared radiation. However, because of the low temperature of the object (about 30~40 degrees Celsius), the wavelength of the infrared emitted will now be of much much longer wavelength. This long wavelength infrared has different property from the short wavelength infared from the sun, especially on its interaction with glass. Glass appears to be opaque to this long wavelength infrared. The infared thus be reflected by the glass and remains inside the greenhouse, be absorbed by the air inside and causing a rise of temperature. This is the mechanism of the 'greenhouse effect' in trapping thermal radiation.