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

Carmine Sarno
Carmine Sarno
19,660 Points

Some pages defaulting to theme index.php

Hi all,

I developed a custom theme on my local machine and added a couple of test pages. Everything appears to work fine locally.

I've since migrated to a host following the steps provided in Zac's video. On the surface, everything looks like it's working properly... the custom theme home page loads and I can navigate to blog entries and custom post types.

The problem is that some of the pages (added in the regular "Pages" admin section) do not load. Instead, when you click on the menu link, it defaults to the theme's index page. The other complication is that some pages work (i.e. they load fine), and others just default to the index. To that end, I can't seem to find out why some are working and others aren't. I've even tried adding a new page from scratch with simple text content, but to no avail.

I've tried updating permalinks. The "Post Name" format further cripples functionality, where the "Default" and a custom structure " /index.php/%postname%/" allows me to navigate to at least one page successfully.

I've also disabled all of the host's default plugins, so the only ones activated are the ones that were on my local machine. The host is Yahoo Small Business, which I'm reading is a terrible choice for a WP host, but that's what my friend currently has.

Any advice on how to trouble shoot this issue would be greatly appreciated!

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Does your theme have a page.php file for the static pages?

Carmine Sarno
Carmine Sarno
19,660 Points

Hi Zac,

Yes, it has a page.php and a page-no-sidebar.php, which is the template I had intended to use for the non-working page(s).

At the moment, the non-working pages are actually displaying the intended content, instead of just defaulting to the static front page, like it was before. However, the content is still being displayed using the index.php template instead of page.php or page-no-sidebar.php.

Funny thing is that I was able to take my local theme dev files and successfully migrate them to a live server using my plain vanilla cPanel-based host, so I'm thinking that this problem is likely due to Yahoo's idiosyncrasies. Looks like my friend (for whom the theme was built) might have to charge to a more WP-friendly host, unless there's a way around all of this.