Viewing 2 replies - 1 through 2 (of 2 total)
  • I think get_posts may be what you’re looking for.

    http://codex.ww.wp.xz.cn/Template_Tags/get_posts

    Thread Starter oliverbennett

    (@oliverbennett)

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

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Page reordering based on metadata’ is closed to new replies.