Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.