wp1.5 themes: year.php, month.php, day.php
-
is it me or these things don’t work as documented?
-
What specific problems are you having with them? My crystal ball is out at the cleaners’. ??
Dunno what the Mooose is experiencing, but when I place a new theme, or even a renamed copy of one of the 2 install themes, they aren’t recognized and presented as options in the control panel.
Themes are usually downloaded separately from WordPress. To install a theme you generally just need to put the theme file or files into your wp-content/themes directory. Once a theme is installed, you may select it here.
Did all of that. So what do you do when “generally” doesn’t apply to you?
If you copy one, you have to make sure to edit the style.css file and change the information at the top. I believe that if WP finds two themes with the same info, it gets confused.
Moose:
in the documentation, archive.php is not supposed to be called for a day, month or year if day.php, month.php and year.php exist.
i found that the is_day(), is_month() and is_year() functions work, so i worked around the problem. still, either the documentation is not up to date, or the theme system isn’t fully implemented.
I just tested with a day.php and it didn’t work for me either. The file was not called.
Denis,
I just took a browse through the code and it doesn’t appear there is anything in WP right now for these day, month, and year templates. When calling templates, there isn’t a check for is_day, is_month, or is_year. Although there is a is_date check and the option to have a date.php.I’ve been trying to implement month.php as documented in the Codex; glad to know it’s not just me it won’t work for.
Codex is wrong. We do date.php, but not year.php, month.php, day.php. You can use is_year(), is_month(), and is_day() inside of the date.php template as DenisdeBernardy noted. Is there a need for year.php, etc.? They weren’t added because that level of templating seemed a bit excessive.
It seems more consistent to have a template for every is_X(). I assume that’s why home.php was added.
I would never use the Templates, but I can’t speak for others.
year.php and friends don’t seem “big” enough to warrant their own template load. Keep in mind that if someone is querying for a day, then is_day(), is_month(), is_year(), is_date(), and is_archive() will be true. Most themes use is_archive() to handle all date type queries. This means WP will need to do file_exists() 4 times before getting to is_archive() and loading the theme’s archive template. Those four file_exists() are a waste if day.php is rarely used in the wild.
Ah – true. Didn’t think about the complexity. I’m convinced.
Long and the short of it for those trying to make year specific templates (for example), is to use is_year() and pals, as has been suggested several times now in this thread.
I don’t mind too much being forced to learn how to use conditionals (though I’d sort of hoped it could be avoided), but this is the second time the Codex has given me duff information on theme development, and that does worry me slightly.
There is, of course, an obvious solution to that, notthatugly.
I did add a note saying that the templates don’t work, but unfortunately I don’t have time to learn PHP, reverse-engineer the entire theming system, and write up my findings right now. The reason I’m resorting to Codex in the first place is because I don’t already know how this stuff works and it is therefore fairly difficult for me to explain it to anyone else.
I do appreciate the efforts of the docs writers, but their consistent failure to grasp this simple point baffles me. Or maybe they see no contradiction in trying to document things they don’t know much about.
(Whatever, I’m through with whining about documentation. If it really mattered to me that much, I’d be using MT, wouldn’t I?)
That was not my point. I understand why people seek documentation: to learn. My point was that, in posting to and reading this forum, you have learned; you now know these templates do not and will not work. You simply have to delete those lines from Codex. But no matter, I just did.
And anyway, thanks for helping to bring attention to the issue.
- The topic ‘wp1.5 themes: year.php, month.php, day.php’ is closed to new replies.