• Hi all

    Got an issue with a client’s site using 2.3.3 (yes I know it’s outdated – no choice at the moment).

    Got a category template that draws on custom fields in posts – it shows all posts in the category with the custom field “Premium” first and then it shows any posts in the category without that field.

    That works fine.

    Problem is trying to order the way the posts with the field “Premium” appear. I can’t even see what order is being used – not date or id or title….

    I need them to be ordered by title.

    Here’s the relevant bit:

    <?php while (have_posts()) : the_post(); ?>

    <?php
    $premium = get_post_meta($post->ID, ‘Premium’, $single = true);
    ?>

    <?php
    if($premium != ”) {
    echo ‘<div class=”premium”>’ ;
    }
    ?>

    I’ve tried adding a full custom query (you know – select * etc) but I can’t seem to get anything working properly.

    Many thanks in advance.

  • The topic ‘Order posts with custom field by title’ is closed to new replies.