Help Desk

Make a link using tribe_get_custom_field('custom field here')

  • | Permalink

    I’m trying to make more aesthetically appealing social media links from my event pages. I would like to wrap the entire social media icon section in it’s corresponding custom field link.

    Please visit http://familyoffestivals.com/event/tomorrowworld-2014/ and direct your attention to the “TomorrowWorld 2014 Popular Links” section.

    This is the current code I have:

    <div class=”instagram-fourth”>
    <p style=”float: center;”><span style=”color: #3f729b;”><i class=”fa fa-instagram fa-5x”></i></span></p>
    <?php echo tribe_get_custom_field(‘Instagram’); ?>
    </div>

    Hope this makes sense, please let me know if you can help. Thanks!

    Posts: 18146 Topics: 17 Answers: 973
    | Permalink

    Hi!

    The basic form for taking a custom field and using it to create a link is as follows:

    <a href="<?php echo esc_url( tribe_get_custom_field( 'Field Label' ) ) ?>"> Link Text </a>

    Does that help?

    | Permalink

    Unfortunately it doesn’t. I am trying to wrap the fontawesome social media icons with it’s corresponding customer field. The code I have is:

    <div class=”one_fourth”>
    <div class=”website-fourth”>
    <p style=”float: center;”><span style=”color: #597798;”><i class=”fa fa-globe fa-5x”></i></span></p>
    <?php echo tribe_get_custom_field(‘Website’); ?>
    </div>
    </div>
    <div class=”one_fourth”>
    <div class=”facebook-fourth”>
    <p style=”float: center; color: #3b5998;”><i class=”fa fa-facebook-square fa-5x”></i></p>
    <p style=”float:center;”><?php echo tribe_get_custom_field(‘Facebook’); ?></p>
    </div>
    </div>
    <div class=”one_fourth”>
    <div class=”twitter-fourth”>
    <p style=”float: center;”><span style=”color: #55acee;”><i class=”fa fa-twitter-square fa-5x”></i></span></p>
    <?php echo tribe_get_custom_field(‘Twitter’); ?>
    </div>
    </div>
    <div class=”one_fourth last”>
    <div class=”instagram-fourth”>
    <p style=”float: center;”><span style=”color: #3f729b;”><i class=”fa fa-instagram fa-5x”></i></span></p>
    <?php echo tribe_get_custom_field(‘Instagram’); ?>
    </div>
    </div>

    Posts: 18146 Topics: 17 Answers: 973
    | Permalink

    OK … I’m still not sure why you can’t use the sort of pattern I described in my last reply – but ultimately I’m afraid for customizations like this you’re really going to have to find your own way forward.

    You can pull out custom field data and use it within the href attribute of a link – as I demonstrated – and that can in turn wrap around other elements, but you’d really need to take that idea and apply it yourself to this particular scenario.

    Since we can’t really help too much more on this one I’ll go ahead and close the thread, but I do hope you figure things out.

    Good luck 🙂