This members-only tutorial provides the steps for showing the visitor's country on the frontend in WordPress.
Caveat: This may not work reliably when your pages are cached, especially on the server-side. You are advised to test this thoroughly before using it in production.
Step 1 - Get IP Address
Let us register a custom function to get the IP address of the visitor.