How to make a "link to this post" box?

Discussion in 'WordPress' started by joseph.stevens7, Aug 22, 2011.

  1. #1
    I would like to find either a wordpress plugin, HTML, javascript, etc. code that would allow me to insert a box at the bottom of my post that would give the users the HTML code to link to the post they were reading, including the title of the post as the anchor text.

    Anyone aware of where I could find these?

    I have seen similar embed code used at beemp3 dot com on their songs pages if you need an example.
     
    joseph.stevens7, Aug 22, 2011 IP
  2. Big0ne

    Big0ne Well-Known Member

    Messages:
    2,614
    Likes Received:
    81
    Best Answers:
    0
    Trophy Points:
    165
    #2
        <?php
        function curPageURL() {
        $pageURL = 'http';
        if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
        } else {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        }
        return $pageURL;
        }
     ?>
    
    PHP:
    Use <?php echo curPageURL(); ?> when needed.
     
    Big0ne, Aug 22, 2011 IP
  3. joseph.stevens7

    joseph.stevens7 Peon

    Messages:
    372
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks BigOne. I'm not so familiar with PHP... what theme file should I put the big chunk of this code in?

    I'm guessing I put the "when needed" part in each post I want that code listed?
     
    joseph.stevens7, Aug 22, 2011 IP
  4. joseph.stevens7

    joseph.stevens7 Peon

    Messages:
    372
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    bump
    Still curious as to where to put this in my theme file
     
    joseph.stevens7, Aug 22, 2011 IP
  5. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,481
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #5
    You need to put this code under index.php and single.php where do you want to place.

    DON.
     
    deluxdon, Aug 22, 2011 IP