Something
public text v1 · immutable<head>
<script type="text/javascript">
function go()
{
box = document.forms[0].order_by_select;
orderby = box.options[box.selectedIndex].value;
if (orderby) location.href = 'index.php?order_by=' + orderby;
}
</script>
</head>
<body>
<?php query_posts('cat=4&posts_per_page=-1&orderby=' . $order_by . '&order=desc'); ?>
<?php if (have_posts()) : ?>
<form id="order_form" action="index.php" method="post">
<fieldset>
<table>
<tr>
<td colspan="4" style="text-align: right;">Sort by:
<select id="order_by_select" name="order_by_select" onchange="go();">
<option value=""><?php echo attribute_escape(__('Select Event')); ?></option>
<?php
$categories= get_categories('child_of=4');
foreach ($categories as $cat) {
$option = '<option value="'.$cat->cat_ID.'">';
$option .= $cat->cat_name;
$option .= ' ('.$cat->category_count.')';
$option .= '</option>';
echo $option;
}
?>
</select>
</td>
</tr>
<tr>
<th>
</th>
<th>
<h2>Title</h2>
</th>
</tr>
<?php while (have_posts()) : the_post(); ?>
<tr>
<td class="col_0">
<?php if (post_custom('book_cover')) { ?>
<a href="<?php the_permalink();?>"><img src="<?php echo post_custom('book_cover');?>" alt="pic" /></a><?php } ?>
</td>
<td class="col_1">
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
</td>
</tr>
<?php endwhile; ?>
<?php endif; ?>
</table>