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 trialPierre Smith
11,842 Pointslink won't navigate to my home page.
I have this for code:
<header>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12" style="background-color: #fff;">
<a href="index.php" title="Professional Student Services Personnel" rel="<?php echo home_url('/'); ?>">
<img src="<?php bloginfo('template_directory'); ?>/img/header/header-img.png" style="max-width:100%;" class="hidden-xs" alt="" />
<img src="<?php bloginfo('template_directory'); ?>/img/header/header-logo.png" style="max-width:100%;" class="visible-xs-block" alt="" />
</a>
</div>
</div>
</div>
and for some reason it won't go to my home page. is there something i'm missing.
Pierre Smith
11,842 PointsYeah I've tried that It just keeps navigating back to the page that I'm currently on. wow I didn't realize that I was editing the real instead of the href. thanks.
1 Answer
Tim Knight
28,888 PointsPierre,
I'm noticing that you're using home_url();
for your rel information, why not use that as well for the primary href here instead of using index.php
? Remember with WordPress index.php servers more like a router to get to the appropriate content in your project. Another thing to remember too is that /
vs. /index.php
are treated as different pages in Google meaning unless you're telling Google Webmaster tools which is your primary homepage they could think one of the pages is duplicate content and not rate it as high as it could be. So that being said, why not just change index.php
to
<?php echo home_url('/'); ?>
Tore Dahl
4,727 PointsTore Dahl
4,727 PointsHave you tried using the bloginfo-function? Like this:
<a href="<?php bloginfo('url'); ?>"> homepage or logo or whatever </a>
https://codex.wordpress.org/Function_Reference/bloginfo