Hi
I know for sure that spanking wont work for a yorkie. He will only learn to be afraid of you.They dont really understand what you are doing and these dogs are so sensitive.He is only 11 weeks old and still does not have the control yet.It will take quite some time to train him completely.
Keeping him in a confined area like a doggie pen is a good way . Dont give him the run of the house.Take him out regularly maybe every half hour. When he go's give him a tiny treat. He will learn that when he go's out there he is rewarded. Even for pee is good to treat to. After he go's then you can let him be out of the pen for a little while with you watching him and playing with him etc. When you have to go out of the room or go out put him back in his pen.
I find it is easier to leave a pee pad in the pen so when you cant be with him he will go on that as they cant hold pee and poop for a long time at this age.
Maybe take his poop outside if he has an accident and show him next time. It might stimulate him to go. They usually go poop after waking up in the morning and after a meal.Even if you catch him doing it in the house just get him outside quickly.
Hope this helps and good luck