Support » Fixing WordPress » Add current URL code

  • I am trying to add current URL to my affiliate links to track profiles dynamically.

    Anyone know what is the PHP code for the current URL? I Just need to add the PHP without spaces at the end of the affiliate link in my sidebar.php.

    I appreciate your assistance.

Viewing 1 replies (of 1 total)
  • Place this bit of PHP anywhere above the link:

    $current_url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

    Then put this bit into your link where you want your current web address:

    <?php echo $current_url; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Add current URL code’ is closed to new replies.