For starters, REMOTE_ADDR isn’t automatically defined.
Use $_SERVER[“REMOTE_ADDR”] instead.
<?php
$IP = $_SERVER[“REMOTE_ADDR”];
echo “This is your IP” . $IP;
?>
Thanks for your help, but that doesn’t work either.
I new at PHP so any help appreciated.
Thanks
That code does work, as I’ve used it many times.
Rather than just saying that it doesn’t work, give specifics. What does it display on the screen? What value does $IP give? Have you tried running it from the command line? Have you tried making a file with nothing but this code and seeing what happens? What server do you have, Apache? If so, What version? PHP version? etc
I’m using Apache, and php 5.2.5, it work in a file by it’s self but does not work in WP side bar displays nothing.
So the code works just not in WP side bar.
can you test it in a side bar in WP let me know how it works for you.
Thanks
The code in sidebar.php doesn’t show up if you’re using widgets. It’s the default non-widget content.
Either stop clear out the widgets in presentation->widgets or else drag up a text widget and copy/paste the code.
And don’t yell (type in all caps). We have no way of knowing from a web browser if you’re using sidebar.php or if you’re using the widgets manager in the admin interface.
[Unnecessary rudeness moderated]