Perishable Press Triple Loop for WordPress

by Jeff Starr on Wednesday, November 22, 2006 59 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!

About the author

[ Jeff Starr ]

Jeff Starr is a web developer, graphic designer and content producer with over 10 years of experience and a passion for quality and detail. Jeff is co-author of the book Digging into WordPress and strives to help people be the best they can be on the Web. + Follow Jeff on Twitter and subscribe to Perishable Press for quality web-design content delivered fresh.


59 Responses
[ Gravatar Icon ]

shaf#1

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

[ Gravatar Icon ]

Perishable#2

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

[ Gravatar Icon ]

Sean#3

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?

[ Gravatar Icon ]

Perishable#4

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!

[ Gravatar Icon ]

James Burns#5

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.

[ Gravatar Icon ]

Perishable#6

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!

[ Gravatar Icon ]

Steve Pierce#7

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

[ Gravatar Icon ]

Steve Pierce#8

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

[ Gravatar Icon ]

richard#9

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…

[ Gravatar Icon ]

Perishable#10

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!)

[ Gravatar Icon ]

Catalin#11

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

[ Gravatar Icon ]

Perishable#12

My pleasure, Catalin — glad to be of service!

[ Gravatar Icon ]

Lauren Grinberg#13

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.

[ Gravatar Icon ]

Perishable#14

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.

[ Gravatar Icon ]

Lauren Grinberg#15

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.

[ Gravatar Icon ]

Perishable#16

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

[ Gravatar Icon ]

Arthur#17

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.

[ Gravatar Icon ]

Perishable#18

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 ;)

[ Gravatar Icon ]

Arthur#19

>>[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!!!

[ Gravatar Icon ]

Danny#20

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.

[ Gravatar Icon ]

Lauren Grinberg#21

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.

: )

[ Gravatar Icon ]

Danny#22

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

[ Gravatar Icon ]

Perishable#23

Danny,

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

Jeff

[ Gravatar Icon ]

Danny#24

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

[ Gravatar Icon ]

Perishable#25

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

[ Gravatar Icon ]

Danny#26

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.)

[ Gravatar Icon ]

Danny#27

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.

[ Gravatar Icon ]

Perishable#28

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 ;)

[ Gravatar Icon ]

Arthur#29

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

[ Gravatar Icon ]

Arthur#30

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

[ Gravatar Icon ]

hedgehog#31

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.

[ Gravatar Icon ]

Perishable#32

@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!

[ Gravatar Icon ]

Luke Knowles#33

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.

[ Gravatar Icon ]

Perishable#34

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_

[ Gravatar Icon ]

Arthur#35

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.

[ Gravatar Icon ]

Perishable#36

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..

[ Gravatar Icon ]

Arthur#37

Thanks Perishable –

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

[ Gravatar Icon ]

Perishable#38

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

[ Gravatar Icon ]

Casey#39

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!

[ Gravatar Icon ]

Perishable#40

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

[ Gravatar Icon ]

MyDeskBlog.com#41

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 …

[ Gravatar Icon ]

Perishable#42

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

[ Gravatar Icon ]

Richard#43

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

[ Gravatar Icon ]

Perishable#44

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!

[ Gravatar Icon ]

tom#45

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…

[ Gravatar Icon ]

Perishable#46

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.

[ Gravatar Icon ]

tom#47

okay thanks I will give it a shot

[ Gravatar Icon ]

tom#48

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!

[ Gravatar Icon ]

Perishable#49

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

[ Gravatar Icon ]

August Klotz#50

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!

Trackbacks / Pingbacks
  1. Kotyk.com » Upgrading
  2. | Main | ABDesign » Article VI Blog Relaunched Today
  3. Cómo funciona el Bucle de WP - introducción « tomando notas
  4. When To Use Magazine-Style Themes For Blogs? | How-To | Smashing Magazine
  5. links for 2009-02-06 « Aggregatore
  6. Fearlessflyer Design » Redesign Teaser
  7. WordPress Loop | Theme Heven
  8. Le petit journal de Wordpress #1
  9. Le petit journal de Wordpress #1 -- css 4 design
Comments are closed for this post

If you have or need further information, contact me.



Next post: Time Test

Attention: Do NOT follow this link!