There are two types of codes. One type is a code embeded in a game, so you can play multiplayer with a person via Nintendo Wi-Fi Connection, and the other type are console codes that let you message people via Wii Connect 24.
There are other things you can do with Wii Connect 24, like use the Forecast Channel, News Channel, Internet Channel, Wii Shop Channel, Everybody Votes Channel, Check Mii Out Channel, and an ability in the Mii Channel. Offline channels include The Photo Channel, and Mii Channel.
The online channels and online games have 2 requirements;
1. An Internet Connection
2. A Router or Nintendo Wi-Fi USB Connector.
If you have any questions, just let me know, I'll do my best to answer them.