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

Trying to get my links to work in Wordpress.

Hey,

So, as the title says, I'm having trouble getting my links to work in Wordpress. I'm following along with Zac making a custom theme.

Anyway, the first page that loads is the front-page.php file. It loads the header and in the header I have my links to other pages. I have a home link, work link, blog link and about link. The problem is, the home link goes to the work.php file, the work link goes to the index.php file. The blog link goes to an empty page and the about link goes to the index.php file.

I'm kinda lost. I just don't know how to get the links to go to the pages I want. Any help would be appreciated. Thanks.

3 Answers

Thiago de Bastos
Thiago de Bastos
14,556 Points

Anyway, the first page that loads is the front-page.php file. It loads the header and in the header I >have my links to other pages. I have a home link, work link, blog link and about link. The problem is, >the home link goes to the work.php file, the work link goes to the index.php file. The blog link goes >to an empty page and the about link goes to the index.php file.

Hi Robin Behroozi ! What are you naming your page files? Have you created:

  • Home --> front-page.php (and set your front page displays to static in the admin panel?)
  • Work --> work-page.php
  • Blog --> home.php
  • About --> about-page.php

Also make sure that your page slugs are named work, home, about


Have a closer look at the WordPress Template Hierarchy

WordPress Template Hierarchy

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Are you also using a custom menu and the wp_nav_menus function?

Hey Zac and Thiago,

Thanks for both of your responses. Zac, I am using a custom menu and the wp_nav_menus function, but I decided to take the Wordpress Theme Hierarchy course to understand what each php file does. I was getting mixed up between Wordpress pages and php files, thinking they were the same thing but they are not. I hope this course explains what each template does. Thanks.