Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here's a strange one. I've been developing a site, including a custom template that I originally worked up from the functionality of the Naked theme. The site has no public blog at the moment; the use of WordPress here was for the sake of content management of pages as well as the use of numerous plugins. Nonetheless, I wnat to "plan in" the flexibility of being able to add a blog down the road, so have been prepping the template and admin for that.

Along the way, however, I've run into strangeness. I've got the look pretty much how I want it, and the individual posts and even monthly archives display fine. Actually, the main blog archive displays okay too, with one exception: It generates a Page not found title (and I do mean HTML title, displayed in your browser tab, not a heading) even though the page obviously is working.

The permalink structure is example.com/blog/%postname%/ but note of course that the actual site home page is not the blog, but a so-called WordPress "static" page.

The problem I'm talking about concerns the page that collates all the posts in order, which is located at example.com/blog/.

Anyone encountered anything like this? I'm wondering if it's a leftover from the fact that I changed the permalink structure, since the actual WordPress installation has been around awhile. However, I deleted all the old posts....

In the General Settings, both the WordPress address and the Site Address are set simply to the domain name. Does one of these need to be altered, and if so, will it mess up my page addresses? I want them to remain example/pagename/ as they currently are.

Is there something else I need to do to properly generate the main blog archive page so that it has the proper title? I wouldn't think so, since the monthly archive page doesn't have the issue ... I'm grasping at straws a bit, and frankly the issue is such that I hardly know what keywords to use to search for an answer.

share|improve this question
    
What are your settings under Settings -> Reading, related to the Front page and posts page? What template file is being used to generate the blog posts index? What have you done to debug? Do you have the same thing happen with a core-bundled Theme, or only with your custom Theme? –  Chip Bennett Jan 10 at 17:08
    
Oo, thanks, good questions. Just realized now that the Settings > Reading has nothing selected for Posts page. (The Front Page is of course set for the static home page.) But the only options in the dropdown are static pages. If I create a page called blog, it's going to draw from my Pages template rather than my index.php, so still not sure how to proceed. Am hesitant to test the other themes in the middle of the day, since the rest of the site is already live. –  Tim Gallant Jan 10 at 17:17
    
I'm thinking about this... Would it work to create a Page Template identical to my index.php, and create a page called Blog based on that, and set that as my Posts page? I'll give that a shot.... EDIT: Nope, tried that, and as I suspected, I lost all my blog content. Even worse, I'm getting a real Page not found after deleting the page. :( –  Tim Gallant Jan 10 at 17:28
    
Nevermind about the last problem. Once I deleted permanently out of the Trash, I got back to my original situation –  Tim Gallant Jan 10 at 17:34
    
Please refer to the WordPress Template Hierarchy. You need to create a home.php, which will be used for the blog posts index. And yes, you must select a static page to assign as the blog posts index page when using a static page as the site front page. –  Chip Bennett Jan 10 at 18:06

2 Answers 2

up vote 1 down vote accepted

Based on your comments above:

Oo, thanks, good questions. Just realized now that the Settings > Reading has nothing selected for Posts page. (The Front Page is of course set for the static home page.)

The problem is, indeed, that you have failed to assign a static page as the posts page (the page ID that WordPress uses to display the blog posts index when a static page is assigned as the site front page.

But the only options in the dropdown are static pages.

Yes, this is how WordPress is designed to work. When assigning a static page as the site front page, you must assign another static page for the blog posts index.

If I create a page called blog, it's going to draw from my Pages template rather than my index.php, so still not sure how to proceed.

Refer to the Template Hierarchy for the Blog Posts Index. In fact, WordPress will never use the Page template to display the Blog Posts Index. The blog posts index template hierarchy is as follows:

  • home.php
  • index.php

So, you can either create a home.php, or simply let the blog posts index fallback to index.php.

share|improve this answer
    
Well, Chip, then it should be working already. It already IS using index.php. –  Tim Gallant Jan 10 at 22:27
    
Did you select a static page to use for the posts page? –  Chip Bennett Jan 11 at 2:34
    
Well, once again, if I choose a static page to use as the posts page, the list of posts no longer shows up. That's much worse than I already have now. As I said, I have a fully working blog index page now. The ONLY thing wrong with it is that in the page title it says "Page not found." That doesn't sound like a hierarchy issue to me, and nothing I see on the Template Hierarchy codex page looks relevant. It's clear that WP is already falling back to my index.php, which is what I want. What isn't clear is why it's not finding the page title. –  Tim Gallant Jan 11 at 3:51
    
Okay, I've got it working. I don't know why it didn't work the first time. But yes, I created a blog page and set it as my posts page and the index is now displaying the proper title. Thanks so much for your help. It steered me in the right direction, although I still find it strange that the index page was already working in every other respect. –  Tim Gallant Jan 11 at 3:58

could be as simple as changing the code you're using to generate the title. are you using wp_title? it's for generating the title outside the loop.

also have a look at codex page for template hierarchy: http://codex.wordpress.org/Template_Hierarchy#Home_Page_display

you can squish that conditional down if you're interested in having the site name appear on every ...

<title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>

share|improve this answer
    
Thanks, Jonathan. You may be onto something there. I'm using if(is_home()) bloginfo('name'); else wp_title('') ... that's in the header for the whole theme, so if I need to change that, I'd have to be careful that I wouldn't break anything else.... Will look at the link you provided. –  Tim Gallant Jan 10 at 17:24
    
you could use front-page.php for your template and rename it to front-pageX.php for now. when your client is ready to roll out a blog, just remove the X. –  jonathan Jan 10 at 17:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.