UPDATE: I tried using the following code:
<?php if (is_category(events)) {
$posts = query_posts($query_string . '&orderby=event_date&order=desc');
} else {
$posts = query_posts($query_string . '&orderby=title&order=asc');
}
?>
Is there a reason why this will not work? It seems that it works great in organizational posts in alphabetical order, but is still out of luck with the date order in “events”.
-
After searching for various existing questions, I cannot find a solution to what I am trying to do.
Currently, all posts on my site are sorted alphabetically, which is great, except for one new category that I added. For this category, I want to order all messages by the value that I enter in a custom field. The field is called "event_date" - so I want to sort the posts by date in essence, but not the date the message was created, the date when the user manually enters this field.
, :
<?php if (is_category($events)) { $posts = query_posts($query_string . '&orderby=$event_date&order=asc'); } ?>
.
:
<?php if (is_category()) { $posts = query_posts( $query_string . '&orderby=title&order=asc' ); } ?>
, , , , , "", .
, , , , , , .