As light travels upward in the earth’s gravitational field, it loses energy, and so its frequency goes down? I have read this question:
Light frequency and time relation
where it says:

As light travels upward in the earth’s gravitational field, it loses energy, and so its frequency goes down. (This means that the length of time between one wave crest and the next goes up.) To someone high up, it would appear that everything down below was making longer to happen.

Now I do understand GR time dilation. I do understand the gravitational potential, and the difference between two places in space (where the gravitational potential is different) will cause time dilation. I understand the Shapiro delay too.
Now what I do not understand is why does a photon's frequency decrease as it travels upwards from Earth? I understand it travels in a changing gravitational field, as it travels upwards, the gravitational potential decreases. But I do not see how the decreasing gravitational field (potential) causes directly the photon's frequency to decrease. Is there a QM explanation to this? Or is there a GR explanation?
Question:


*

*Why is a photon's frequency decreasing because it travels upwards in Earth's gravitational field, that is it travels in a decreasing gravitational field (potential)?

*Do all photons coming out of the Sun have a decreased frequency compared to when they were emitted nearer the core?
 A: There are several equivalent answers. 
Since you already understand gravitational time dilation, that is probably the most direct. Suppose that you have a clock which is deep in a gravity well so that it is running slowly. Say every 1 s on the deep clock is 2 s on your clock. Now, if that clock is used to drive a 1 MHz signal, then you will receive that 1 million cycles over 2 s due to the time dilation. That means the frequency would be reduced to 0.5 MHz. 
Another equivalent explanation is that the energy of the photon is decreased, and since $E=hf$ the reduced energy necessarily implies a reduced frequency. The energy of a photon is reduced as it travels upwards because as the photon goes up it must trade some of its EM energy for gravitational potential energy. If it didn’t then you could make a perpetual motion machine*.  
Another, more technical explanation, would be using parallel transport. The Schwarzschild coordinates are well suited to describing hovering observers. As a null vector is parallel transported upwards it gets “redshifted” relative to hovering observers at higher coordinates. 
I am sure there are more ways, but hopefully one of those works for you. 
*For example suppose we have some gravitational potential difference. Now, if you anhilate an electron and a positron at the bottom you will get two 0.5 MeV photons. If they can go up without losing energy then at the top they would still have 0.5 MeV each, so you could recombine them to form an electron and a positron. You could then let the new electron and positron fall, gaining KE. At the bottom you could extract that KE, and after doing so you could start the cycle over again by anhilating the new electron and positron. Therefore, the photons must lose as much energy going up as the electron and positron gain going down. Anything else results in non-conservation of energy. 
A: light is drawn towards the planet and not refracted or reflected by any ozone layer. as the ozone layer is made up of O3 it is highly conductive of light due to the nature of its bond. I believe the going theory is that ozone is less stable than o2 as its is ambient at living altitudes but this fails to account for the fact that any form of oxidation is a o2 reaction as o2 mixes with alot of different elements, whereas o3 only mixes with Carbon. this would be due to the fact that carbon can hold an electrical charge which allows it to make it to the atmosphere and discharge in the creation of o2 and co2. you know the gas that we hook up to our beloved beer kegs and coke machines which can conduct electricity stably, lightning, and create neat fluffy clouds when hit with the H20 in the moisture carrying hot air as it rises. All my very own written description of the occurance. anyway as the light hits the ozone layer from our side it would react with the gasses present in the environment and its energy would be discharged and contained in the carbon of those clouds much like the carbon nano tubes that scientists are just pioneering and build until they reach enough for energy discharge between the stratoshere and the ground in the form of lightning. light doesnt leave this planet once its here. it doesnt leave any carbon or alkali metal containing planet as they store energy at their cores or has some form of atmosphere which would trap with varying form of greenhouse effect. Which allows us to see them as air is invisible because it doesnt impede, react or absorb light 
A: *

*It's not the decreasing gravitational field that causes the change in frequency, it's the increasing length of time that the photon is exposed to a strong gravity well at all. Despite the decreasing strength of the field (rather than because of it), it continues to cumulatively affect the frequency of the escaping photon.

*Yes. Both because of the direct effect of gravity, and because the expansion of spacetime causes constant redshift - two different kinds of stretching of spacetime, similar result.
