Skip to content


WordPress: multi-loop

In a previous post, I looked at The Loop in WordPress and how it was possible to exclude specific categories from being displayed. I did that to exclude posts from my Web category as I wanted them handled differently.

This time around, I’m going to retrieve and display posts without going into The Loop. To do this, I’m going to create a secondary loop with the get_posts template tag.

At the simplest level, you could use this to create a sticky post (though as of version 2.7, WordPress does this without any additional coding). By playing around with this, you could create a multi-loop, multi-column theme that completely changes the way a blog looks.
Continued…

Posted in WordPress.


Elsewhere

Best episode titles ever. “Inverse Raging Fire Punch! There are Too Many Who Deserve to Die!!”

Posted in Web.


Elsewhere

Good Old Games interviewed. “If we added DRM I’m sure we’d have an easier job of bringing on new publishers. But, well, we like a challenge, and we’re going to stick to our ideals.”

Posted in Web.


Elsewhere

Space Invaders coin bank. This working 1/6-scale table version of the classic game is meant to get you to save up to 80 100yen coins.

Posted in Web.


WordPress: hacking categories

The Loop is your basic WordPress doodad. (Please do not be intimidated or alarmed by my command of fancy-pants terminology.) Its function is to retrieve and display the latest posts with the number of posts displayed per page set by the user in WordPress’ Admin page (Settings>Reading). I’ve got this blog currently set to display five posts per page.

A basic loop looks like this:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

BLAH BLAH BLAH

<?php endwhile; else: ?>

<p>Sorry, no posts matched your criteria.</p>

<?php endif; ?>

The BLAH BLAH BLAH is the section of the loop that determines how each post is displayed. In most themes, this will retrieve and display the title, date, time and author name along with the actual post content.

Now I’ve got a Web category on this blog that presents links I’ve found on the … Web. Rather than do the typical blog thing of grabbing an image and padding the entry with some snarky comments, I simply present these links with a brief one-line description if necessary.

I got it in my head that I would restyle the blog so that it handled these quick link entries differently from the rest of the blog. This involved three different tasks: excluding the Web category from the main loop, displaying the five latest posts in the Web category on the left sidebar and finally changing how posts are displayed when viewing the Web category.
Continued…

Posted in WordPress.