Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress From Bootstrap to WordPress Create Bootstrap Styled Theme Templates Creating a Portfolio Single Page

Paul Roberts
Paul Roberts
7,928 Points

<?php the_field('link'); ?> problem.

Right at the end of he video Zac uses:

<a href="<?php the_field('link');" ?>View Final Piece</a>

When he clicks his button it takes him to his custom post URL but for me it adds this URL to the end of the local wordpress URL and so doesn't work.

What am I doing wrong?

Paul Roberts
Paul Roberts
7,928 Points

Ah, if anyone else is interested...

It is a requirement that you add http:// to the beginning of your links otherwise it assumes they are not URLs.

1 Answer

It is a requirement that you add http:// to the beginning of your links otherwise it assumes they are not URLs.

No, this should not be the case. How did you setup this custom field ? Check if you selected the URL Option if using a external link or the Page-Link Option if you want to link to a page on your own site. The URL Option will require you to add http:// and won't let you save a post without it. My first guess is you're using a text-field instead of a URL or Page Link field.