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

Carl Sergile
Carl Sergile
16,570 Points

Hardcoded link WordPress

Hey again guys, I'm trying to add some hardcoded links into my Wordpress site. Does anyone know the best way to get this done?

Right now I have this in my footer: <li><a href="https://twitter.com/carlcreative"><span class="fa-tweet"><i class="fa fa-twitter-square fa-2x"></i></span>https://twitter.com/carlcreative</a></li>

It shows up fine but was wondering if there is any other way because WordPress does not like this method. Im guessing its for security issues but im just not sure. Any help on this would be great

Thanks guys!!!

Hi Carl,

Can you clarify what you mean by WordPress does not like that method? You generally, also want to have any external links open in a new window/tab.

<li><a href="https://twitter.com/carlcreative" target="_blank"><span class="fa-tweet"><i class="fa fa-twitter-square fa-2x"></i></span>https://twitter.com/carlcreative</a></li>
Carl Sergile
Carl Sergile
16,570 Points

oh okay does target="blank" take care of the new window popping up?

Also I use this plugin called Theme Checker and I get this message: INFO: Possible hard-coded links were found in the file footer.php. Line 28: <li><a href='https://twitter.com/carlcreative'><span class='fa-tweet'><i class='fa fa-tw.....

Maybe adding target="blank" will clear this?

3 Answers

Hi Carl,

Yes, adding

target="_blank"

Will cause it to open in a new window/tab. It is unlikely that will change anything for that plugin. Its more of a "Hey, did you know this was here?" It is only an issue if this is a theme you are trying to publish on a repo somewhere. If this is strictly for personal use, I would ignore it as they are links to your twitter account I would assume that is the case.

Warning is that you generally want the content pulled via the admin/dynamically. You could call it with a widget and that would most likely remove that from displaying for you.

Carl Sergile
Carl Sergile
16,570 Points

Nice thanks for clearing that up for me, and yes, this is a personal theme that I will be using on my own site. If I were to hand this site to a client can I still link up like this? or is the widget way the best way for this....

Overall, the less you have to hardcode the better. In short, anything you can allow to be modified via the admin is better as it can be dynamically pulled/generated and allows a client to make changes themselves (not that many do).

There is a plugin called Options Framework Plugin that allows a lot of things to be added via the admin and can be called on the front of the site making life a lot easier for a developer.

http://wptheming.com/options-framework-plugin/

Carl Sergile
Carl Sergile
16,570 Points

Okay thanks will def check that plugin out!