V patch: mp-wp_thetarpit-theme.vpatch (seal).
The results presented here can be obtained by: first, copying the "default" theme directory to a new one and changing the comment at the top of each php file so that the "subpackage" field reflects the name of the new theme1.
Second, one may optionally remove the sidebar by searching for all
calls to the get_sidebar
function and commenting/removing that
line2.
Third, one should adjust the style.css
file to reflect the desired
visual layout, i.e. colours, font, column size etc. Additionally, it's
easy to remove the gradient-ish header by editing header.php
and
removing the inline CSS referring to "kubrickblahblah.svg". This step
can be run in a feedback loop with others, e.g. adjusting the column
size after removing the sidebar.
Fourth, one should adjust archives.php
, i.e. the "Archives" template
to contain the desired content, e.g. in this theme's case a search
box, the categories and the monthly archives.
Fifth, one should create a new template named "First" for the first
page. Creating a new template is achieved by creating a new file, say,
first.php
, which at the beginning contains e.g.:
<?php
/**
* @package WordPress
* @subpackage TheTarPit
*/
/*
Template Name: First
*/
?>
Obviously, we then need to display the header:
<?php get_header(); ?>
and then the content. We won't go into details regarding how to display e.g. recent posts and comments3, but after you've done this, you must similarly make it echo the footer:
<?php get_footer(); ?>
Sixth, one may display the pages described in the fourth and the fifth steps by e.g. creating a new page in the Wordpress administrative interface and setting the "Template" field to the desired template. If your template doesn't appear there, then you've most likely botched something in the code, so please to go back to the fifth step.
Seventh, there are other small things that you might wish to do, for
example getting the proper selection mechanism in
place4. Similarly, you can add Trilema-style random taglines to
your header.php
by first adding to your theme's functions.php
:
function thetarpit_head() {
$taglines = array('A witty tagline',
'Yet another witty tagline',
'You're going to laugh your ass off reading this');
$tagline = $taglines[mt_rand(0, count($taglines) - 1)];
update_option('thetarpit_tagline', $tagline);
}
and
add_action('wp_head', 'thetarpit_head');
then in header.php
changing the following call
bloginfo('description');
to
get_option('thetarpit_tagline');
Of course, the pseudo-random array indexing can be replaced with a database query into a new table or whatever; this can be adjusted as the user desires.
Eighth, one may now finally lie back and admire his new theme. It may not be perfect, much like the hack-ridden process of arriving here wasn't. That's fine though, even God himself rested after making his imperfect earth.
-
Although to be honest, I've observed no difference in keeping those comments as they are. This is mostly a cosmetic change for whomever reads the code. ↩
-
People don't seem to like the single-column format and I quite see the reason: there's all those useful quick links accessible through the sidebar that would otherwise require navigating to another page, which is, I agree, annoying.
Here's my visual design philosophy instead: I don't want to clutter your visual field with things that are not immediately necessary when you're reading a post. If you're reading e.g. this article and you suddenly expect to move to, say, recent posts and then immediately back to the article, then I'd say this is a very peculiar habit; while we're at it, why not add a third column to display the comments for the current post in parallel with the main content?
Anyway, this is how this theme works: if you want to access quick links and such, they're all on the first page. Want to take a look at recent comments? then simply navigate to thetarpit.org and there you'll find them.
All this being said, I'm vehehery far from anything resembling a UX expert, so I don't expect my words on the matter hold much weight. ↩
-
Long story short, look for
wp_recent_posts
andget_comments
in your MP-WP tree, using thegrep -rw
method outlined in the exploration tutorial. ↩ -
For the record, The Tar Pit theme comes with server-side selection included. ↩
Meanwhile we observe that the "recent comments" functionality on the first page is utterly, utterly broken. Let's take a look at it:
Notice the error? The code takes the most recent 30 posts, regardless of post type, and only then filters out pingbacks. So if Wordpress happens to start a flood of pingbacks (for example, as a consequence to post categories being updated), then none of the new non-pingback comments are displayed anymore.
The fix is pretty simple: account for post types when querying the database, and limit the query for a given post type to a given 'number'. Until that's implemented, I guess the reader will have to occasionally suffer from the lack of recent comments.
[...] mp-wp_thetarpit-theme.vpatch (spyked) (sauce) [...]