WordPress.com will have an updated version of Sandbox available very soon. Current Sandbox users will be able to keep the older version for a while.
This article is aimed at WordPress theme designers. “Aimed” because there is a gun to your head. “Designers” because the issue relates to the specifications that all themes should follow. So take off your Artist hat, put on your Designer helmet and get ready to dodge bullets. To the shooting range »
This won’t matter to most WordPress.com users but I removed a bunch of unreachable code from almost every template file in Sandbox. The logic of this should be understood by all theme authors so that you don’t waste your time maintaining useless code!
This is the crux: at the top of the main loop,
is_404() are mutually exclusive. If we have posts it is not a 404. If it is a 404 we have no posts. If
is_404(), template-redirect.php sends us to 404.php (index.php if that’s missing). Thus
have_posts() will never be false at the top of single.php, archive.php, etc. unless a plugin is doing something very wrong.
Does your theme provide an
else handling in every loop of every template file? If it does you’re maintaining code that will never be executed by the server. Do yourself a favor and execute it–with an axe.
So why are so many themes testing
have_posts() at the top of the loop? The bundled themes have been recycled without enough critical thinking. Probably the documentation needs a comb-through. I’m generally too busy thinking up new stuff to worry about all that old stuff. Bad Andy. Will somebody step up?
- There are now previous/next navigation links above the content as well as below. These can be selected with #nav-above and #nav-below.
- The dl/dt/dd at the top of the archives have been simplified. No more crazy default styles to contend with.
- The entry-meta separators now have a “metasep” class. This makes Asides much easier to do!
- Whitespace has been removed from #globalnav to accommodate a problem in Internet Explorer.
- The pesky abbr tag is now wrapped in a div with an “entry-date” class.
In reviewing category.php, Scott noted that it didn’t make sense for each post to have links to the current category archive. With some custom code, we now display “Also posted in…” if there are any other categories to show. See it on my WordPress category archive page.
One more change comes to mind: I removed a whole lot of code almost every Sandbox template file. I’ll tell you about it in another post.
If you have published a Sandbox stylesheet, thank you and please update it as soon as possible!
This is a small warning to all who have adopted Sandbox and begun to create your stylesheet:
The markup is going to change tonight. The changes will be small but noticable. We’re changing some minor classes, adding some classes, removing some presentational text and removing the definition lists. These changes will go live on WordPress.com in a few hours. I’ll (probably) post more details and a link to a SVN repo and a download when it’s up.