• I put this code in my side bar does not work can someone help

    <?php
    $IP = GETENV(“Remote_Addr”);
    Print(“This is your IP – ( $IP ).”);
    ?>

Viewing 12 replies - 1 through 12 (of 12 total)
  • Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    For starters, REMOTE_ADDR isn’t automatically defined.

    Use $_SERVER[“REMOTE_ADDR”] instead.

    <?php
    $IP = $_SERVER[“REMOTE_ADDR”];
    echo “This is your IP” . $IP;
    ?>

    Thread Starter slate62

    (@slate62)

    Thanks for your help, but that doesn’t work either.

    I new at PHP so any help appreciated.

    Thanks

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    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

    Thread Starter slate62

    (@slate62)

    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.

    Thread Starter slate62

    (@slate62)

    can you test it in a side bar in WP let me know how it works for you.

    Thanks

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Are you using widgets?

    Thread Starter slate62

    (@slate62)

    YES

    Thread Starter slate62

    (@slate62)

    See my site @

    Thread Starter slate62

    (@slate62)

    thewayweblog.com

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    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.

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    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.

    Thread Starter slate62

    (@slate62)

    [Unnecessary rudeness moderated]

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘code in side bar’ is closed to new replies.