It's bad enough if your poor dog had to have surgery, but there might be instructions from the vet that he will also need to be crated in order to have a smooth recovery time. Your poor dog, whether he's a Pug or a bulldog is not going to understand why he has to stay in the crate and is going to think he's done something wrong if you don't help him while he's a patient. So since his physical limitations are going to disturb him, it's a good idea to try and keep his mind stimulated instead.
The first thing you need to do is talk to your vet about how you can keep him calm for the first few days of his confinement so that he'll be able to get his much needed rest. Sometimes your vet will prescribe a light sedative so that your dog will be kind of sleepy and a lot calmer, especially if your dog has never been crate trained, this is going to be important.
It's important that you give your dog a lot of different toys and things to chew on that are safe, while he is in the crate. You need to make sure he has enough things in there to keep him occupied and keep his mind off of trying to get out of the crate. You should also provide him puzzle toys that contain food or snacks that will take him some time to figure out how to get the food out.
When it is time for a bathroom break for your dog, and short exercise periods, that are prescribed by your dog's vet, make sure that you use this time to show him attention and to practice some of the easier commands he's been taught like sit, heel, etc. This will give him a little exercise and will continue to stimulate his mind and gives you bonding time together. Dogs love to bond.
You could also teach your dog new things while he's cooped up in the crate. Things that don't take a lot of movement. For instance if you think your dog looks cute when he yawns, teach him how to yawn on command by giving him a little treat every time he yawns and then use the command “yawn” when you want him to do this.
Whatever you do, don't add any extra stress to your dog while he's in the crate, the surgery and the crate are enough stressers for the time being. Make sure to let your friends and family members know that he needs his rest and try to keep the visiting traffic down to a minimum. Make sure that the lights in at least the area where he is are dimmed and don't put the crate near a window anywhere in the house. You will help cut down on his curiosity and barking at things outside.
Understand that when your dog finally gets the go ahead to exercise normally again, he is going to be out of shape so you will need to gradually let him get back to his normal schedule. And never be afraid to contact your vet during the healing process should their be behavior developing that is out of the ordinary for your dog, it could be caused from being kept in the crate. And never give medication to your dog that was not prescribed by your vet.