moshu:
Perhaps you could give an example of “edit the existing loop”. Or maybe point me to a link in the codex that explains it. Looking through the source code, there’s no reasonable way to do that. By the time WordPress gets to your category-6.php template, the posts have already been queried. Altering anything, including the order, would require another post retrieval from the database, thus another query.
From the source code, this is how the logic goes:
wp-blog-header
-> wp-config
-> -> wp-settings
wp-settings creates the 3 main objects, $wp, $wp_query, and $wp_rewrite
The functions.php for your template is then loaded. Here’s the kicker though. There’s been no query parsing yet, so you can’t use the conditional checks to see what page is being loaded. In fact, setting anything here in relation to the current request is useless, because when the $wp object is initialized, it will totally erase what you set.
Now after wp-settings is done loading, we go back to wp-blog-header. The reason of the logic is as such:
wp-blog-header
-> the $wp object is initialized.
-> wp-template-loader
As you can see the $wp object is initialized before the templates are loaded, thus querying the database at the same time for the appropriate posts.
As far as I can tell, to properly change the way your posts are being displayed without doing a second database hit (different order, whatever), you’ll have to either create a plugin, or add an action in your template’s functions.php page. You can then hook into the “pre_get_posts” action, which will allow you to change the query vars in $wp_query.
So basically, no, I don’t believe you can just “edit the existing loop”.