I have wireless connection to my printer but it does not always connect/print
Wireless printers can be a real devil to connect to. It's always best to follow the makers instructions, usually these are supplied with the printer. If you've lost them you can usually download a copy from the makers website, all you need is the make and model of your printer.
There are various methods in use. Most common is to initially connect the printer to the computer using a USB cable, you can then supply the printer with all the required setup info. Another method is to access the printer's setup Menu where there will be a way to set up the required information. Yet another method is to press the WPS button on the printer and your router. Both buttons need to be press within a brief period or the router will time out, if this happens to you just try again a little quicker.
Your printer may require some or all of the following information:
Note that the Router usually provides the IP Number to the printer automatically.