The best treatment for sore nipples is prevention. The best prevention is latching the baby on right from the very first day.
Sore nipples are usually due to one or both of two causes.
Either the baby is not positioned and latched properly, or the baby is not suckling properly, or both. The soreness caused by the latching and ineffective suckle hurts most as you latch the baby on and usually improves as the baby nurses. The pain from the fungal infection goes on throughout the feed and may continue even after the feed is over. Women describe knifelike pain from the first two causes. The pain of the fungal infection is often described as burning, but may not have this character.