• I am pretty green with php but here is what I am trying to accomplish. I want my field to equal the link I enter for it. On my wp post I have an area for websites (text field) and I want to have that website link. Hope this makes some sense. here’s what I have.

    echo "<div id='event_website'>";
    
        echo "<a href='".get_field('event_website')."' target='_blank'></a>";
    
    echo "</div>";

    For example if I am entering http://www.google.com into my field and I would like it to say http://www.google.com when it’s echoed. There are two problems I have run into. The first would be the link should link outside the site (currently it links inside the site) and the second would be having the link echo the actual link. Again I hope this makes a little sense. Thanks! Any suggestions on reading would be appreciative too, never hurts.

Viewing 1 replies (of 1 total)
  • Thread Starter Stoplosstm

    (@stoplosstm)

    So the second issue was resolved with assigning a variable.

    <?php
    $event_url = get_field('event_website');
    ?>
    <?php
    echo "<div id='event_website'>";
    
        echo "<a href='".get_field('event_website')."' target='_blank'>$event_url</a>";
    
    echo "</div>";
    ?>

    Now I just need to link it to an external location. Currently it links as such.
    wwww.thisismysite.com/internapage/www.eventsite.com

Viewing 1 replies (of 1 total)

The topic ‘PhP & Adcanced Custom Fields Links’ is closed to new replies.