Consistency is crucial. This may mean taking time off work to be there to take the pup outside every 20-30 minutes when they are awake. Crate training will also help the 'penny drop' as it teaches the pup to hold on until taken outside. Then, be sure to stay with the pup in the yard so you are there to reinforce how clever they are when they do go in the right place.
It also helps to teach your puppy a “potty phrase” when you take him outside for a bathroom break. A potty phrase is a way to gently remind your puppy what he needs to do when he’s outside. It’s a big help during the potty training phase of puppyhood and you can continue to use for the rest of his life. Pick a phrase like “hurry up” or “go ahead” and say it softly right as your puppy eliminates. In time your dog will associate the phrase with the act of elimination, so you can say it when your puppy gets distracted and forgets what he needs to do outside.
It’s best not to punish the puppy for making a mistake. Instead, focus on praising appropriate bathroom behavior. If you catch your puppy in the act, interrupt it by saying “No!” in a firm voice or clapping your hands loudly, then take the puppy outside to finish going to the bathroom. Never swat your puppy, yell at it, or try to rub its nose in the mess.