I got the same problem when I changed my G2's display. It could not be charging while it was ON but only while it was turned off. It could open once it was fully charged though very slowly.
As Kevin said somehow the battery temperature was read -30 degree and the android stopped the phone to charge. I found a temporary solution by setting the battery fake mode on in the hidden menu (3845*#802# to enter hidden mode >> Battery>> fake mode on/off. Note: 802 is the phone model number, replace it with your phone model number). In that way the battery charge is shown always as 80% but it will be charged and you can turn fake mode off again to see the battery charge.
However, it was working for me for a couple of weeks after that It turned off while it wasfully charged.
I opened my phone back cover and take out the battery. I realized that the guy who replaced the battery had not removed the protective plastic film on the back of new display to place the battery again. When removed it worked!!! :)))
I think there is a grounding or maybe a temperature sensor on the back of the battery which somehow grounds the battery to the chasis via the black adhesive film on the back of display platform. Just check if the battery is placed properly without any gap or spacing to its position.