I think get_posts may be what you’re looking for.
http://codex.ww.wp.xz.cn/Template_Tags/get_posts
Thanks, esmi.
Just in case anyone else is interested I ended with this:
<?php
$querystr = “
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = ‘type’
AND wposts.post_type = ‘page’
ORDER BY wpostmeta.meta_value DESC
“;
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
And then:
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>
” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?>
<?php echo get_post_meta($post->ID, “type”, $single = true);?>
<?php endforeach; ?>
<?php else : ?>
<h2 class=”center”>Not Found</h2>
<p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
<?php include (TEMPLATEPATH . “/searchform.php”); ?>
<?php endif; ?>