Perishable Press Triple Loop for WordPress

Published Wednesday, November 22, 2006 @ 7:12 pm • 52 Responses

Two of the themes developed by Perishable Press, Apathy and Information, depend on three WordPress loops to operate as intended. For each of these themes, the three loops consist of two "side" loops and one main loop. The side loops each display posts from one specific category, while the main loop displays posts from every category not specified in the side loops.

There are many different multi-loop configurations currently available for WordPress users. Needless to say, despite a wide variety of available loop setups, implementing a customized multiple loop frequently requires a great deal of time of energy. Certain loop sets accomplish one task, but fail at another, while others refuse to provide enough flexibility in general. Indeed, after countless rounds of trial and error establishing multiple loops, we finally developed the almost-perfect triple-loop configuration.

The Upside

The Perishable Press triple loop for WordPress provides several specifically designed features:

  • Each side loop displays posts from any unique category.
  • Each side loop displays any unique number of posts.
  • The main loop may exclude posts from any category.
  • The main loop displays no posts included in either side loop.
  • The main loop displays any unique number of posts.
  • Post views function properly for any post in any loop.

The Downside

The Perishable Press triple loop for WordPress currently encompasses these specific caveats:

  • Archive navigation is only possible for the main loop.
  • The main loop must precede both of the side loops.
  • The "side loops" technically are neither "side" nor "loops".

Additionally, the main loop will look at the first “x” number of posts, and display only those posts which are not included in either side-loop category. Thus, if the most recent “x” number of posts all belong to either of the side categories, there will be no posts to display in the main loop. Fortunately, there are several relatively simple solutions for this situation, which will be discussed at the end of this article.

The Main Loop

As mentioned, the main loop must appear before the two side loops. Fortunately, the magic of CSS nullifies the restriction imposed by this requirement. Another important point to mention involves the lack of archive navigation (e.g., << previous | next >>) for either of the side posts. Although this may be possible, I have yet to determine an optimal method.

Nonetheless, complete navigation comes standard with the main loop. The side loops work perfectly for displaying the latest "x" number of posts from their respective categories. An elegant solution would be to provide a nice "Read more posts from this category »" link for each side loop display.

Moving along, our first task is to exclude our two chosen side categories from the main loop. Here, we are instructing WordPress to process posts as usual, with the exception that all posts from either side-loop category are ignored. Here are the first three lines of the main loop:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if ( in_category('7') && is_home() ) continue; ?>
<?php if ( in_category('8') && is_home() ) continue; ?>

Above, the loop starts with the usual "if():while()" statement, and then proceeds into a key pair of conditional if statements. The first conditional statement filters out all posts from category 7, while the second does the same for category 8. The remainder of the main loop is expressed as usual, as generalized here, replete with several key elements:

// the first loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if ( in_category('7') && is_home() ) continue; ?>
<?php if ( in_category('8') && is_home() ) continue; ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php posts_nav_link('','','&laquo; Previous') ?><?php previous_post('&laquo; %', '', 'yes'); ?>
<?php posts_nav_link('','Next &raquo;','') ?><?php next_post('% &raquo;', '', 'yes'); ?>
<?php else : ?>
<p>Sorry..</p>
<?php endif; ?>

The previous loop example includes title, contents, comments, and navigational elements, as well as an else statement issuing a nice "Sorry" message for those awkward, missing-post moments. For more information regarding the WordPress loop, visit the WordPress Codex.

The Side Loops

As previously noted, the term "side loops" is a bit of a misnomer. Instead of the standard "if():while()" loop intro, the two secondary loops each begin with "get_posts()" and "foreach():start_wp()" statements. With such, the secondary loops function similar to standard loops, but employ a different functional method. As far as calling them "side" loops, well that is just a convenient name, as they may display posts anywhere, not just on the side of a web page.

Now, with the main loop in place, it is time to add the two side loops. Here is the basic setup:

// the second loop
<?php query_posts('cat=7&showposts=3'); ?>
<?php $posts = get_posts('category=7&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

// the third loop
<?php query_posts('cat=8&showposts=3'); ?>
<?php $posts = get_posts('category=8&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

Okay, in the previous example, the second loop is querying all posts in category 7 and displaying the first three, beginning with the most recent posts. The second post acts similarly, with the exception that it queries posts from category 8. Each loop also contains a title and excerpt element, included for the sake of demonstrative clarity.

Several important points should be mentioned here. For each of the two side loops, there are two parameters indicating category number, two parameters indicating the number of displayed posts, and one parameter indicating an offset value. For this triple-loop configuration to function properly, it is essential to provide matching parameters for both category and post display number. That is, the values "cat=8&showposts=3" must correspond precisely to the values "category=8&numberposts=3". Same category, same number of posts to display. Meanwhile, the offset parameter should remain at zero.

Thus, to customize the two secondary loops, simply choose two unique category ID’s and corresponding values specifying how many posts from either category you wish to display.

All Together Now

Now that I have bored you nearly to death with all of the gruesome details, here is the complete code for the Perishable Press triple loop for WordPress:

// the first loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if ( in_category('7') && is_home() ) continue; ?>
<?php if ( in_category('8') && is_home() ) continue; ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php posts_nav_link('','','&laquo; Previous') ?><?php previous_post('&laquo; %', '', 'yes'); ?>
<?php posts_nav_link('','Next &raquo;','') ?><?php next_post('% &raquo;', '', 'yes'); ?>
<?php else : ?>
<p>Sorry..</p>
<?php endif; ?>

// the second loop
<?php query_posts('cat=7&showposts=3'); ?>
<?php $posts = get_posts('category=7&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

// the third loop
<?php query_posts('cat=8&showposts=3'); ?>
<?php $posts = get_posts('category=8&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

That’s all there is to it — copy, paste, and tweak to taste!

Caveat

As previously discussed, the main loop will look at the first “x” number of posts, and display only those posts which are not included in either side-loop category. Thus, if the most recent “x” number of posts all belong to either of the side categories, there will be no posts to display in the main loop. Fortunately, there are several relatively simple solutions for this situation:

  1. Increase the number of posts that are displayed in the main loop via the Admin > Options > Reading panel.
  2. Decrease the number of posts that are displayed in the side loops via step 5a and 5b in the Installation instructions above.
  3. Simply add a few more (or however many it takes) posts to categories appearing in the main loop (i.e., non-side-loop categories).

A Million Loops

With a little imagination, it is easy to envision a case where more than three loops might be required. Fortunately, our method for dishing three WordPress loops may be extrapolated into four WordPress loops, five WordPress, loops, six WordPress loops, …even a million WordPress loops. Well, okay, maybe not. Nonetheless, for any reasonable number of loops, if you have the categories, we have the code!

Here is a hypothetical, generalized example demonstrating "n" number of WordPress loops:

// the first loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if ( in_category('2') && is_home() ) continue; ?>
<?php if ( in_category('3') && is_home() ) continue; ?>
<?php if ( in_category('4') && is_home() ) continue; ?>
<?php if ( in_category('5') && is_home() ) continue; ?>
.                .      .         .            .
.                .      .         .            .
.                .      .         .            .
<?php if ( in_category('n') && is_home() ) continue; ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>

// the second loop
<?php query_posts('cat=2&showposts=3'); ?>
<?php $posts = get_posts('category=2&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

// the third loop
<?php query_posts('cat=3&showposts=3'); ?>
<?php $posts = get_posts('category=3&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

// the fourth loop
<?php query_posts('cat=4&showposts=3'); ?>
<?php $posts = get_posts('category=4&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

// the fifth loop
<?php query_posts('cat=5&showposts=3'); ?>
<?php $posts = get_posts('category=5&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>
.     .     .     
.     .     . 
.     .     . 
// the nth loop
<?php query_posts('cat=n&showposts=3'); ?>
<?php $posts = get_posts('category=n&numberposts=3&offset=0'); 
foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>

Well, surely I have worn out my welcome here. Perhaps you will be so kind as to drop a comment to share your particular experience with multiple WordPress loops. Cheers!


Dialogue

52 Responses Jump to comment form

1shaf

December 26, 2006 at 11:02 am

i am just looking at this layout. please excuse the snooping.

2Perishable

December 26, 2006 at 12:17 pm

Help yourself! — if you have any questions, please don’t hesitate to ask..

3Sean

January 16, 2007 at 6:29 pm

i just put two loops in my template on the index.php file and for some reason now the and no longer works properly in the sidebar. it works on the single page, but on the home page the sidebar just doesn’t show up at all - i’m trying to just have certain elements of the sidebar show up on the home page and then different stuff show up on the single post page.

this is definitely related to the second loop because when i take it out, everything works fine.

any idea why?

4Perishable

January 17, 2007 at 8:56 am

Sean,
It is difficult to diagnose issues without seeing the code itself. If multiple loops function properly on single pages, you might try emulating the same code on the index page and working backwards. It sounds like a conflict between the loops and whichever code happens to be different on the two pages. Also, PHP can be very picky — many times the solution lies in something as simple as scripting syntax or even punctuation. If you are totally stuck and need more help, send me an email with some commented code (zipped, please) and I will do my best to help you. My email address is located at the bottom-left corner of our contact page.
- Cheers!

5James Burns

February 20, 2007 at 11:27 am

my question is that I really want one of my “side loops” to be at the top of my page just under the header.

I would like to use it as a feature post, but if the code for the second loop has to follow the main loop how can I get it to come in at the top of my page.

6Perishable

February 21, 2007 at 8:27 am

James,
From looking at your blog, it appears that you have found a solution? If so, then great. There are also several WP plugins available for "side blogs" — perhaps a search will provide more options for you.. Otherwise, to use the method described above in such fashion, you could always employ a little CSS to reposition the header after the page has been parsed by the server. Just a few ideas..
- Good Luck!

7Steve Pierce

May 1, 2007 at 9:10 am

I am trying out the apathy template but I am getting the error in the right hand column

Fatal error: Call to undefined function: c2c_get_recent_posts() in C:\websites\217\ypsinews.com\wp-content\themes\apathy\index.php on line 155

www.ypsinews.com/index.php

This is running on IIS6

If you have any suggestions they would be most appreciated

Cheers!

_ Steve

8Steve Pierce

May 1, 2007 at 9:14 am

Whoops, I didn’t enable the two plugins, sorry about that. - Steve

9richard

September 18, 2007 at 8:23 am

is it possible to use this multiple loop setup to display the main loop on one page, and one of the side loops on a different page… a WP Page?

I’m looking for a way to split posts into two streams, so to speak, and display on separate pages within the same blog.

Just wondering if this is the right direction at all…

10Perishable

September 18, 2007 at 9:35 am

richard,
Not sure if I am understanding you here..
With WordPress, each page may employ its own loop or series of loops. You can loop through any content on any page(s) you wish. Um, I guess I really need more information to keep going.. ;) If you have examples of the pages or something, it would definitely help..
(Interesting site, by the way!)

11Catalin

October 7, 2007 at 9:51 am

Great tutorial dude you really saved me from google`ing arround all day searching for multiple loop examples

12Perishable

October 7, 2007 at 1:04 pm

My pleasure, Catalin — glad to be of service!

13Lauren Grinberg

October 16, 2007 at 7:27 pm

My set up, still in local-test-run, is: sidebar1.php then index.php then sidebar.php.

i want to have the sideloops in sidebar1.php and the post content in index.php.

So far, I have got the sideloops working but the post content in index.php which shouldbe showing all other posts instead shows the “Sorry” message no matter how many posts I have in the other categories (not the sideloop cats). Any ideas?

p.s. thanks for taking the time to publish your tips.

14Perishable

October 17, 2007 at 8:03 am

Lauren,
Have you tried combining the contents of the three files into one (i.e., the index.php)? That would eliminate the placement of the secondary loops in the sidebars as a potential cause of the issue.

15Lauren Grinberg

October 17, 2007 at 9:14 am

I somewhat fixed the problem after reviewing the procedure. I think the problem was that index.php was calling for sidebar1.php before the content. Once I moved the call everything fell into place, except the main content is now in the lefthand sidebar. I can live with that with a few design tweeks.

Thanks again.

16Perishable

October 17, 2007 at 9:40 am

No problem — glad to hear things are working! ;)

17Arthur

November 6, 2007 at 6:15 pm

I’m trying to implement the hiding of posts in the main section if they show up on a sidebar via your “if ( in_category(”)” statements and everything does display correctly per category.

However, the next and previous links don’t work as expected. The home page shows posts in the main section, but if you click on “previous” the resulting page doesn’t show any posts in the main area, although the second and third loops do work showing their posts.

If I comment out the lines in the index file to hide posts in the categories showing posts in other loops, all is good. This is on a server on my workstation so I can’t show it to you live as yet. Any thoughts?

Thanks in advance.

18Perishable

November 6, 2007 at 9:16 pm

Arthur,
Keep in mind that the side loops “steal” x number of posts from the primary loop. Thus, if there are only 10 posts total, and the side loops each show three (3+3=6), that only leaves four posts to display in the main loop. Therefore, depending on the number of posts you have set to display in the primary loop, say five, there may be no additional posts to show on the next archive page. The solution, of course, is to populate the database with more posts, or throw down some conditional navigational links to avoid the confusion. I realize I am assuming a lot here, but without more information it is difficult to advise. I hope this helps ;)

19Arthur

November 7, 2007 at 10:32 am

>>[T]here may be no additional posts to show on the next archive page. The solution, of course, is to populate the database with more posts[.]<<

Absolutely correct! Thanks so much for the timely response. All is working fine now.

What a great resource, this site!!!

20Danny

November 14, 2007 at 9:38 pm

I am so bewildered.

I have an old blog (running WP 2.0.5) and I can get this to work fine. Actually, I only want the code from the side loops for a project on a particular page. My tests there work fine.

But on the new blog (running WP 2.1.2) where I actually want the code to work, I cannot get it to work to save my life.

I feel it will be something silly.

I have the EXEC-PHP (v4.0) plugin installed in both blogs. PHP seems to be working ok; I get the expected result when I try the test…

<?php echo "This is the Exec-PHP 'Hello World'"; ?>

…so no problems there.

The option “WordPress should correct invalidly nested XHTML automatically” is not checked.

I am not using the WYSIWYG editor. The ‘unfiltered html’ and ‘exec php’ capabilities are new to me, but I don’t believe this to be a problem since I’m posting from the admin account and since the Exec-php test is working correctly.

But I just cannot get it to work. Here is the code that works in the old (v2.0.5) blog but not in the new (v2.1.2) blog.

<div style="background-color:#CCCCCC; float:left; width:46%; padding: 10px">
<?php query_posts('cat=7&showposts=2'); ?>
<?php $posts = get_posts('category=7&numberposts=2&offset=0'); foreach ($posts as $post) : start_wp(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endforeach; ?>
</div>

The category is populated with posts.

The code stands alone on a WP page (for now). When I save the page and try to load it, it usually churns for a while and times out. I get one line of the background color defined in the DIV statement.

I really hope someone can save my sanity and help me understand why it works one place and not the other.

Thank you very much.

21Lauren Grinberg

November 15, 2007 at 10:00 am

Danny,

I compared your code to mine (I use WP2.3) and it looks the same. One thing that tripped me up, and was very silly, was the actual category number. I had been working on my localhost which used a different number as the actual online blog (I hadn’t made a fresh copy of the DB and installed it locally). I’m a novice and DID get this Triple Loop working. Forgive me if my suggestion is BEYOND obvious.

: )

22Danny

November 16, 2007 at 10:21 am

Lauren,

No suggestion is too obvious including making sure that I have the monitor on.

I did get tripped up early with the category #, and especially making sure that both parameters (category & number of posts) were the same both places, but I am quite sure that it is correct.

I can’t figure what the problem is, and it’s quite vexing. I would be glad for any help or other suggestions. (The problem is outlined in comment #20.)

Danny

23Perishable

November 18, 2007 at 9:33 am

Danny,

Are you running the additional loops through EXEC-PHP on both blogs?

Jeff

24Danny

November 18, 2007 at 1:43 pm

Hi Jeff,

Not sure exactly what you are asking…

Both blogs have EXEC-PHP installed. The old blog doesn’t really need/use the loops, but I tested the code there first, and it worked fine.

The new blog is where I would like to use the loops. EXEC-PHP is installed there also, and as I said, this php test code worked fine on the new blog:

<?php echo "This is the Exec-PHP 'Hello World'"; ?>

So at least some php is executing okay on the new blog.

Thanks. I hope I answered what you were asking.

Danny

25Perishable

November 18, 2007 at 2:08 pm

Danny,

Okay, the reason I ask is because I am not sure that WordPress loops will run properly (or at all) when executed via a plugin such as Exec-PHP. The post itself is already being processed within a loop, and I am not certain that execution of a “loop within a loop” is possible. Have you tried running the additional/side loops directly from within the index.php (or other) file? Sorry if I am assuming too much here, I am only trying to help. ;)

Jeff

26Danny

November 18, 2007 at 2:23 pm

That’s very interesting.

In my old blog (WP 2.0.5), I just created a WP page and slapped the php into the WP page and let EXEC-PHP handle it. Worked fine.

But definitely not working in the new blog (WP 2.1.2). Frankly, it didn’t occur to me put it in the code of the page itself especially since it worked it in the text of the WP page.

I’ll try it.

(I don’t have shell access and so am waiting for my host to help me restore to WP 2.1.2 since something went awry in an attempted upgrade to 2.3. But can hardly wait to try it.)

27Danny

November 18, 2007 at 9:54 pm

Early signs for me are that it works as expected when put into the code of a page as you suggested (and intended). I was trying to get it to do something that it was not intended to do, and I so very much appreciate you helping me get straightened out.

This could be really sweet… thank you so very much.

28Perishable

November 19, 2007 at 8:09 am

You’re welcome!

It is interesting that you managed to get a secondary loop to run via EXEC-PHP in WordPress 2.0.5. I wonder if that is an anomaly in that version of WordPress that was fixed in subsequent versions. Regardless, I think it is more secure/stable to run the loop directly via .php document rather than through a page or post.

In any case, I am glad to hear that you got it working.
Best of luck to you and your blog ;)

29Arthur

November 21, 2007 at 1:50 am

I have the multiple loops working perfectly on a test blog on my workstation server, with no repeating of posts in the main blog area, however I’ve just taken the whole thing live and the posts in select categories do show up in the highlighted sections as desired, but they are repeating in the content area of the blog. Any suggestions would be much appreciated.

http://www.article6blog.com/

Arthur

30Arthur

November 21, 2007 at 1:53 am

Doah!!! Never mind — forgot to change the category numbers in the main index template. Now it’s working fine.

31hedgehog

December 14, 2007 at 9:56 am

Hi, just a question and please sorry for my english :P

What about excluding from the side loops just the post (and not the category) displayed in the main loop?
Obviously while still assigning a category for each side loop.

32Perishable

December 16, 2007 at 12:13 pm

@Arthur: Glad to hear you got it working!

@hedgehog: I have yet to venture into those waters, however, you may want to try experimenting with the built-in private posts feature. If that doesn’t provide any clues, you may try cannibalizing code from a plugin that deals with individual post filtering, such as static front page or something.. Sorry if that wasn’t very helpful — hopefully it will provide a few leads to follow. Good luck!

33Luke Knowles

December 18, 2007 at 4:47 pm

This is a great tutorial. One question. How do I order the posts alphabetically by the title for the second loop? Thanks for your help on this.

34Perishable

December 18, 2007 at 10:27 pm

Hi Luke,

To do this via plain code injection (per category view):

<?php if (is_category()) { $posts = query_posts($query_string . '&orderby=title&order=asc'); } ?>

Or, throw down via WP plugin:

1) Custom Query String Reloaded (extra phat, very flexible)

2) Sort Category Posts by Title (cats only, have not used)

3) WP-Snap Plugin (auto-listed, alphabetic posts)

4) Smart Sort (user-selected options for custom sorting)

5) aStickyPostOrderER (customizable post organization)

That should get you started ;)
Great site, btw — read on it earlier today via WPThemesPlugin.com

Regards,
Jeff_

35Arthur

December 19, 2007 at 2:17 pm

I have several loops working on the blog, article6blog.com. On one of them there is a box that features the title of the most recent post in a certain category, along with that post’s Optional Excerpt info, and then below that are the titles of the five most recent posts from the same category. As it now stands, the most recent post’s title gets repeated in that secondary list area. Is it possible to call for the list of (x) most recent posts but have the actual most recent one skipped?

Thanks in advance for any advice.

36Perishable

December 26, 2007 at 11:57 am

Hi Authur,

Have you tried using the offset parameter?

For example, using this code in your secondary loop:

<?php query_posts('cat=7&showposts=3&offset=1'); ?>

You would skip the first post in category 7 and display the next 3 most recent..

37Arthur

December 26, 2007 at 12:38 pm

Thanks Perishable –

That did the trick! What an amazing site you have here. The knowledge base is remarkable.

38Perishable

December 26, 2007 at 1:28 pm

Glad it worked for you! Thanks for the feedback and kind remarks ;)

39Casey

December 31, 2007 at 10:41 am

yeah, that’s what I am talking about! This is the best tutorial on multiple loops I’ve read and it works like a charm, even when the first loop is a page (not a category).

KUDOS!

I wish it had been easier to find - I can’t tell you how many plugins and wp “tutorials” I tried before this clear, concise (and more importantly) ACCURATE and FUNCTIONING tutorial on using multiple loops!

THANK YOU!

40Perishable

December 31, 2007 at 10:50 am

My pleasure, Casey — thank you for the rave review! :)

41MyDeskBlog.com

February 18, 2008 at 12:55 am

Just what I needed to get me out of the loop!

Thanks for the effort of putting this together. It’s what I’ve been looking for. Gonna print it out and test things out myself.

I wanted to do much more than just listing 10 recent posts. Things like popular posts, featured posts, related posts and all …

42Perishable

February 18, 2008 at 9:23 am

Absolutely! Triple loops are perfect for creating unique and versatile blog layouts via WordPress. Don’t have too much fun! ;)

43Richard

March 8, 2008 at 11:21 am

Hi Perishable,

Firstly, thank you for this tutorial. I am a relative novice and this was excellent. One thing, I have the drop down category menu widget going and there seems to be a conflict. My home page now comes up as “Links | Philatelic Database” instead of just “Philatelic Database”. I can live with this yet I just thought i’d let you know in case you know of a fix.

Thanks again,

Richard

44Perishable

March 8, 2008 at 9:32 pm

Hi Richard, thanks for the positive feedback. As for the issue with the title of your home page, there are a number of things that could be causing the conflict. First, does the term “Links” disappear when the triple loop is removed? And/or, does the term disappear from the title (as displayed at the top of the browser) when the category widget is removed? Checking either of these items should provide additional clues.. If you need more help with this, please contact me directly. Thanks!

45tom

March 17, 2008 at 1:26 am

Trying to get it to work with a date query and not having any luck.

Ie:

loop 1 = mondays posts
loop 2 = tuesday posts

and so on…

46Perishable

March 17, 2008 at 10:19 am

You may want to try setting a variable for the get_the_time() tag, and then employ a series of if()/else() conditions within a multiple-loop configuration.

47tom

March 18, 2008 at 12:40 pm

okay thanks I will give it a shot

48tom

March 18, 2008 at 1:19 pm

actually I found something simpler but you led me to investigate it.

if you use the_date inside the loop it only displays the date once, so even if you have 3 posts from that day you can make the date a header.

different then the_time, pretty sweet though!

49Perishable

March 19, 2008 at 10:10 am

Excellent, Tom — I am glad you got it working! :)

50August Klotz

March 19, 2008 at 10:14 am

Nice work with this article. I have referred to it for a number of projects and find it to be quite useful. Thanks for sharing it with us!

Subscribe to comments on this post


[ Comments are closed for this post. ]

If you have additional information, contact me.

← Previous post • Next post →

« WordPress on Crack: Tips for Faster Post PublishingTime Test »

Contact Perishable Press

  • Contact Jeff via form

Search Perishable Press

About Perishable Press

Perishable Press is the virtual playground of Jeff Starr — visionary, founder and lead developer of Monzilla Media, a small web and graphic design company in the lush desert oasis of Moses Lake, Washington. Perishable Press features articles and tutorials on many aspects of digital design..

Read more..

Perishable on Twitter

automation is great: i've got photoshop batch processing 300+ images while FTP is simultaneously uploading them to the server..

Perishable on Tumblr

Tons of Firewalls

Tuesday, 7 October 2008, 1:45 am

Recently overheard on conservative talk radio (instructing listeners how to obtain a free promotional video from their new website):

“This website has tons and tons of firewalls, so you have to use your real email address to download the video..”

The Quiet Search Revolution

Monday, 6 October 2008, 12:15 pm

Just a thought.. As awesome as Google is these days, it would suck if they ended up owning the entire search-engine business. When they get to the point where all competition is impossible (due to their sheer size, financial resources, media influence, etc.), how many alternate search engines will have the resources for continuous improvement and top-quality search results? When this happens, we will have no choice but to do exactly what Google tells us to do.

As deeply ingrained as it is for everyone to instinctively and unthinkingly turn to Google for their search activity, it is time to leave a few alternate search tabs open for as much use as possible. Instead of using Google just because that’s what you always do, try your search on MSN, Yahoo, Ask, or any of the other independent search engines instead. Sharing traffic with other search engines is a nice, quiet way to keep the competitive spirit alive and well in the search-engine business.

Disappearing WordPress Posts

Wednesday, 1 October 2008, 7:50 pm

Today I experienced difficulties while trying to publish or even save new posts in WordPress. I would compose the post as usual, add all of the keywords, tags, meta tags, and so on, but as soon as I clicked the “Publish” or “Save” button, the post would just disappear from existence.

The weird thing is that during the drafting process, WordPress’ default auto-save feature showed that the post had been saved at expected intervals. Unfortunately, after trying to publish several different posts, WordPress showed absolutely no record of the posts ever being created. They simply vanished into thin air.

Fortunately, a little investigation revealed the culprit. If you should find yourself dealing with this same issue, here are some different things that you should try. First, re-upload fresh copies of your entire WordPress installation. I don’t know why exactly, but apparently various files can either go stale or completely disappear from the server. Overwriting or writing fresh files may do the trick.

If that doesn’t work, check your WordPress database for errors. In my case, a little investigation revealed that something had caused a couple of fatal errors in the wp_posts table. Fortunately, checking and repairing the table solved the issue.

Tumblr Battles

Wednesday, 1 October 2008, 5:30 pm

Please excuse the duplicate Tumbr posts.. seems there is no way to ping Tumblr to refresh/rebuild the RSS feed according to changes in post content. So, to resolve the issue I have discussed now like two or three times regarding paragraph elements and proper feed formatting, I have no choice but to repost a majority of my text posts.

This is necessary for the proper import and display of my Tumblr feed into WordPress. Currently, there are five items displayed at once, each styled according to proper inclusion of paragraph tags. Thus, whenever the Tumblr feed “forgets” to enclose single-paragraph posts with the proper tags, the result is an unstyled post entry displayed on my site.

Assuming that makes sense, you will please excuse my dust while I repost a few older entries in an attempt to reconstruct (the hard way) a properly formatted Tumblr feed.

More Optimization Measures

Wednesday, 1 October 2008, 5:27 pm

Another important step in improving the performance of my recent redesign involves the optimization of both CSS and JavaScript content. During development there were around 15 server requests for these two types of files, 10 JavaScript files and 5 CSS files. This was okay for my own use, but would not work for production purposes.

Optimizing these file types involves consolidation, compression, and caching. Consolidation of 10 JavaScript files into three is huge improvement. Now I deliver one JS file for the functionality of the site, one for Mint, and another for Analytics. Likewise for the stylesheets; after consolidation, a single stylesheet is delivered to all modern browsers. There are two additional stylesheets as well, but they are targeted at IE6 and mobile browsers and will not load elsewhere.

Once the files were consolidated as much as possible, it was time to optimize or “crunch” them. Using the sexy Flumpcakes CSS optimizer, I was able to reduce my stylesheets by around 25%. Likewise for JavaScript, I used xtreeme.com’s optimizer to shave an additional 20% off the size of my JS content.

Finally, once I had consolidated and compressed my JS and CSS files as much as possible, I wanted to further my optimization efforts by ensuring that these files were cached by the browser. By setting far-future Expires headers for everything but the statistical files, my site gains an additional performance boost by eliminating the need to reload preexisting content.

Read more on Tumblr..

Subscribe to Comments Recent Dialogue

  • Adam Singer: Thanks for this. You're right, if it isn't broken, don't fix it. I was about to update my permalinks and install a plugin to redire...
  • Marilyn: It looks great on my browser! I wish I had that much creativity in my head! It's gorgeous!...
  • Randy: "Too girly?" It looks like a great design. Define "too girly!"...
  • Christopher Ross: .htaccess based redirects are wonderful. I'm always baffled by web professionals who don't take the time to learn more about them....
  • federico: Hi Jeff... tnx so much...it worked perfectly... c u Federico...
  • Cooltad: The skin seems (mostly) fine in my expert opinion. Your one of the few people able to make a design with a transparent table and a b...
  • Neal: The free Intro to Linux book is a great place to start http://www.ischool.utexas.edu/mirrors/LDP/LDP/intro-linux/html/index.html ...
  • Louis: @Jeff: Your “Archives” page is slick, although I would expect a cleaner implementation from such a vehement advoc...
  • Jeremy: Well I think that you may be over-critical, I don't see a darn thing wrong with it - I like it a lot!...
  • Jeff Starr: Alright, this is exactly the kind of information I was hoping to get. Lots of great ideas and recommendations here. I will be reading...

Read more recent comments..