Guinea pigs learn throughout their life. My 3 ish year old female learned to pee in a litter tray within the space of a couple of weeks.
If they have a specific corner they like to pee in, put the tray there. You can start by putting a little bit of soiled bedding in the tray. When they sniff around, they get the gist of it, and start peeing there. My younger female (8 weeks when I got her) was more stubborn, she preferred to sleep in it. So I put in a little hay (that she couldn't resist), as she tends to eat and pee/poop at the same time. That worked fine. They both (almost always) pee in the tray now. They still both poop everywhere. Never been successful with that!