• good day, quick question, I have a site that pulls posts from certain category, basically the code to see how I call those posts is as follows:

    <div class="jumbotron">
    <h2>Ultimos Estrenos Nintendo Wii</h2>
    <?php query_posts('cat=99&order=DSC&showposts=11&paged='.get_query_var('paged')); ?>
    <?php if (have_posts()) :  ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php echo get_permalink(); ?>"><?php the_post_thumbnail( 'thumb-small' ); ?></a>
    <?php endwhile; ?>
    <?php else: ?>
    <p><?php _e('No posts were found. Sorry!'); ?></p>
    <?php endif; ?></p>
    <br /><br />
    <a href="https://bluegames.com.ve/category/nintendo-wii/" class="btn btn-xs btn-warning">VER TODOS LOS ESTRENOS</a>
    </div>

    As you can see I’m using order=DSC to order posts but the client has a custom field that is a code, they want to order those posts using that custom field, but I’m not sure how to achieve that, I call that custom field using this:

    <?php echo get_post_meta($post->ID, 'Codigo de Pelicula', true); ?>

    But I don’t know how to order those posts using that custom field, so, asking, someone with that kind of past experience that can help with?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Ordering posts by custom fields’ is closed to new replies.