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

how to link to your home.php in wordpress

how can l ink to my blog listed page (home.php)from my home page(front-page.php) in wordpress. l tried <?php echo get_template_directory_uri(); ?>/home.php but it doesn't return anything. any ideas would be greatly appreciated.

2 Answers

Andrew McCormick
Andrew McCormick
17,730 Points

home.php and front-page.php are just templates that use wp_query to display posts according to the url that calls it. in the case of your blog, have you tried just linking to yourdomain.com/blog ?

hi thanks for your answer Andrew McCormick l couldn't use that because am currently working locally and was looking for a fix to navigate to that page without having to make any changes in the code when l put the site live.

Always use

<?php bloginfo('url'); ?>

to link to your front page, just put it inside the link tag.

l want to link to my home.php not the front-page.php