You asked

Do I need to stop breastfeeding if I have an infection?

There are very few cases where you would need to stop breastfeeding if you have an infection. It makes far more sense to continue breastfeeding as this will actually help protect your baby. By the time you have developed any symptoms of an infection you have already been breastfeeding for several days, by continuing to nurse you will give your baby the best protection against this infection. Your breastmilk will contain special antibodies that will help prevent your baby from getting sick.
Even in cases of breast infections, such as mastitis it is far better to continue breast feeding. If the infected nipple is too sore you can use the other side for a day or two. The infection will heal far more quickly by continuing to breastfeed. If you do have an infection that you are concerned about you should always visit your G.P. who will clarify whether you can continue breastfeeding.

More questions

Mums understand the benefits of breastfeeding and some may be tempted by online sources if they're reluctant to breastfeed themselves or are having problems.
Babies can often be fussy in the evenings and you may find it difficult to nurse or settle them. 
Here are ways to know if your baby is getting enough milk
Breastfeeding and medication: what you need to know
What's the difference between breastmilk and formula?
Breastmilk has plenty of iron to last your baby at least the first six months of his life. 
Nipple shields are used if baby wont take the breast or for sore nipples
As of February 21st 2011 the HSE is recommending that all babies, including babies that are breastfed be given 5 micrograms of vitamin D3 a day. This is because recent studies have shown that mothers and...
Spitting up is very common and most young babies spit up at least once a day. This is because their digestive systems are immature which makes it very easy for their stomach contents to come back up their...