The Sandbox is a lot of things:
More importantly, and related to the last item, the Sandbox can be a lot of things.
What began as ScottAllanWallick's leftovers has become an advanced, semantics-based theme. AndySkelton added his innovative semantic class-generating functions and Scott edited it to oblivion.
So what can you do with the Sandbox?
The real feature of the Sandbox is its markup. The use of class-generating functions in the body, post div, and comment/trackback li elements create an exceptionally extensible foundation. As Andy said, Given straightforward markup with plenty of selectors, there isn't much that can't be accomplished with CSS and a decent browser.
And the implementation of the hAtom and hCard microformats means we're looking forward (and pleasing the barons at Technorati). You might be able to improve on our markup, but, well, who wants to work that hard?
The Sandbox theme is installed just like any other WordPress theme. To install this theme:
/sandbox/ folder from the archive/wp-contents/themes/ directoryYou can read more detailed installation instructions on the WordPress Codex.
The three semantic class-generating functions used in the Sandbox are charted below, outlining what semantic classes are generated by each function (“Class”), any related WordPress function (“WP Tag”), and the usage of these classes (“Usage”). For more on the WP Tag aspect, read the Template Tags and Conditional Tags articles on the WordPress Codex.
sandbox_body_class()The sandbox_body_class() function is definied in the functions.php file. It has no parameters. It adds semantic classes to the body element relative to the content of the page that is being displayed.
<body class="<?php sandbox_body_class(); ?>">The chart below lists the classes added to the body tag by this function.
sandbox_body_class() |
||
|---|---|---|
| CSS example | ||
body.single div.sidebar { display: none; } |
||
| Class | WP Tag | Usage |
| archive | is_archive() |
When any archive page is displayed, i.e., applies to category-, date-, and author-based archive pages |
| attachment | is_attachment() |
When the post subpage containing an attachment is displayed, as set with "Linked to Page" in the post editor |
| author | is_author() |
When a author archive page is displayed |
| author-[name] | is_author() |
When a specific author archive page is displayed, where [name] is the author's login name, e.g., author-admin |
| author-paged-[n] | is_author() & is_paged() |
Displays the "paged" number of author archive, where [n] is the paginated number |
| category | is_category() |
When a category archive page is displayed |
| category-[name] | is_category() |
For a specific category, where [name] is the category slug, e.g., category-useful-links |
| category-paged-[n] | is_category() & is_paged() |
Displays the "paged" number of category archive, where [n] is the paginated number |
| d01–31 | gmdate('d') |
The current day of when the page is displayed (Offset to GMT) |
| date | is_date() |
When a date archive page is displayed, e.g., by month, by year |
| date-paged-[n] | is_date() & is_paged() |
Displays the "paged" number of date-based archive, where [n] is the paginated number |
| h00–24 | gmdate('h') |
The current hour of when the page is displayed (Offset to GMT) |
| four04 | is_404() |
When a request results in zero posts, i.e., a 404 error page |
| home | is_home() |
When the home page is displayed |
| m00–12 | gmdate('m') |
The current month of when the page is displayed (Offset to GMT) |
| loggedin | n/a | When the page is displayed by a logged-in user |
| page | is_page() |
When a page is displayed |
| page-author-[name] | is_page() |
For a page by a specific author, where [name] is the user's login name, e.g., page-author-admin |
| page-paged-[n] | is_page() & is_paged() |
Displays the "paged" number of pages, where [n] is the paginated number |
| paged | is_paged() |
When whatever is displayed is "paged," e.g., page 2 of the index |
| paged-[n] | is_paged() |
Displays the "paged" number, where [n] is the paginated number, e.g., paged-3 for third page of index |
| pageid-[n] | is_page() |
Displays the page ID number of queried page, where [n] is the page ID, e.g., pageid-20 |
| postid-[n] | is_single() |
Displays the post ID number of queried post, where [n] is the post ID, e.g., postid-20 |
| search | is_search() |
When the results of a search are displayed |
| single | is_single() |
When a single post is displayed |
| s-author-[name] | is_single() & is_author() |
For a single post published by a specific author, where [name] is the user's login name, e.g., s-author-admin |
| s-category-[name] | is_single() & is_category() |
For a single post published in a specific category, where [name] is the category slug, e.g., s-category-news |
| s-d01–31 | gmdate('d') |
For a single post published on a specific day (Offset to GMT) |
| s-h00–24 | gmdate('h') |
For a single post published at a specific hour (Offset to GMT) |
| s-m00–12 | gmdate('m') |
For a single post published in a specific month (Offset to GMT) |
| s-y2007 | gmdate('Y') |
For a single post published in a specific year (Offset to GMT) |
| wordpress | n/a | When anything is displayed; a class that is always applied |
| y2007 | gmdate('Y') |
The current year of when the page is display (Offset to GMT) |
sandbox_post_class()The sandbox_post_class() function is definied in the functions.php file. It has no parameters. It adds semantic classes to each post div element, relative to the actual post it contains.
<div id="post-<?php the_ID(); ?>" class="<?php sandbox_post_class(); ?>">The chart below lists the classes added to each post div element by this function.
sandbox_post_class() |
||
|---|---|---|
| CSS example | ||
div.category-news .entry-title { background: url(news.png); } |
||
| Class | WP Tag | Usage |
| alt | n/a | For odd-numbered posts, e.g., 1st, 3rd, 5th, etc. |
| author-[name] | is_author() |
For any specific author, where [name] is the user's login name, e.g., author-admin |
| category-[name] | is_category() |
For any specific category, where [name] is the category slug, e.g., category-news |
| hentry | n/a | For the hAtom 0.1 specification, applied every post |
| p[n] | n/a | For counting posts relative to the top of the page, where [n] is the number, e.g., p1 for the first post, p2 for the second post, p3 for the third post, etc. |
| page | n/a | A general class, applied to every page |
| post | n/a | A general class, applied to every post |
| private | n/a | For a post that has been saved as "private" |
| protected | n/a | For a post that has been password-protected |
| publish | n/a | For any published post, as contrasted with an unpublished draft |
| h00–24 | gmdate('h') |
For a post published at a specific hour (Offset to GMT) |
| d01–31 | gmdate('d') |
For a post published on a specific day (Offset to GMT) |
| m00–12 | gmdate('m') |
For a post published in a specific month (Offset to GMT) |
| y2007 | gmdate('Y') |
For a post published in a certain year (Offset to GMT) |
sandbox_comment_class()The sandbox_comment_class() function is definied in the functions.php file. It has no parameters. It adds semantic classes to the each comment li element (“comment” here meaning comments, trackbacks, and pingbacks). It is used in the comments.php file as follows:
<li id="comment-<?php comment_ID(); ?>" class="<?php sandbox_comment_class(); ?>">The chart below lists the classes added to each comment li element by this function. Again, note that "comment" includes comments, trackbacks, and pingbacks.
sandbox_comment_class() |
||
|---|---|---|
| CSS example | ||
div.comments li.bypostauthor { border: 1px solid red; } |
||
| Class | WP Tag | Usage |
| alt | n/a | For odd-numbered comments, e.g., 1st, 3rd, 5th, etc. |
| bypostauthor | n/a | When the comment author is also the post author |
| byuser | n/a | For any comment by a registered user |
| c-h00–24 | gmdate('h') |
For a comment posted at a specific hour (Offset to GMT) |
| c[n] | n/a | For counting comments relative to the first, where [n] is the number, e.g., c1 for the first comment, c2 for the second comment, c3 for the third comment, etc. |
| c-d01–31 | gmdate('d') |
For a comment posted on a specific date (Offset to GMT) |
| c-m00–12 | gmdate('m') |
For a comment posted in a specific month (Offset to GMT) |
| c-y2007 | gmdate('Y') |
For a comment posted in a specific year (Offset to GMT) |
| comment | n/a | A general class, applied to every comment |
| comment-author-[name] | n/a | For a comment by a specific registered user, where [name] is the user's login name, e.g., comment-author-john |
| t[n] | n/a | For counting trackbacks relative to the first, where [n] is the number, e.g., t1 for the first trackback, t2 for the second trackback, t3 for the third trackback, etc. |
| trackback | is_trackback() | When a comment is a trackback/pingback |
The Sandbox is compliant with both XHTML and CSS standards. What does this mean? An explanation of web standards from The Web Standards Project:
Complying with web standards can give your web pages greater visibility in web searches. The structural information present in compliant documents makes it easy for search engines to access and evaluate the information in those documents, and they get indexed more accurately.
Accessibility is an important idea behind many web standards. Not only does this mean allowing the web to be used by people with disabilities, but also allowing web pages to be understood by people using browsers other than the usual ones — including voice browsers that read web pages aloud to people with sight impairments, Braille browsers, hand-held browsers, teletext displays, and other unusual output devices.
You can read more about developing with web standards at 456 Berea Street.
Microformats are markup that express semantic information in your blog, for example. People and machines similarly can extract information from webpages marked up in a microformat much like feed readers extract information from Atom or RSS syndicated feeds. Essentially it's about making content more accessible.
Microformats that have been implemented in the Sandbox theme include (less XFN, which is built into WordPress):
Microformats help the Sandbox be an especially POSH WordPress theme. POSH stands for "plain old semantic HTML." It is a term used to refer to best practices of semantic HTML development. The Microformats Wiki POSH article has a working copy of these best practices:
b, and no <br />a element with only a name attributeSo the Sandbox can be highly POSH, but the semantic use of HTML elements is completely up to you.
In addition to the more advanced, code-related features of the Sandbox, there are at least two other features that make the Sandbox a highly viable choice as a base theme.
Comments are not displayed on pages by default, but are displayed on posts, per the current convention. You can enable comments on a per page basis by adding a custom key/value with the text "comments."
To enable comments on a page:
commentsEnabling comments simply attaches the comments.php file to the page. You can turn off comments on a page by deleting the comments key/value. This does not delete any exisiting comments, but simply disables them from loading.
There are two page templates included: Links Page (links.php) and Archives Page (archives.php). You can add a title, text, and enable comments (see above) with both of these page templates.
To use the page templates:
The Archive Page template displays archives by month and by category. The Links Page displays links by link category.
The Sandbox © 2006–2007 is licensed under the GNU General Public License:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.