Skip to main content
3 of 3
added 837 characters in body
micah
  • 235
  • 4
  • 12

How can I sort the order of multiple custom field values in a custom post type?

Here's the website: [KunzlerIP][1]

At the bottom of the website, you see a slider using Fancybox. Each thumbnail pops up some content from an individual custom post type post. For this custom post type, I've enabled the following:

    function post_type_lawyers() {
    register_post_type( 'lawyers',
        array( 
            'label' => __('Lawyers'),
            'public' => true,
            'show_ui' => true,
            'hierarchical' => true,
            'supports' => array(
                'title',
                'thumbnail',
                'page-attributes',
                'post-thumbnails',
                'custom-fields',
                'revisions',
                )
        )
    ); //end register_post_type
    register_taxonomy( 'lawyer', 'lawyers', array( 'hierarchical' => true, 'label' => __('Rank') ) );
}
add_action('init', 'post_type_lawyers');

The info for each pop-up is a custom field value and key. Currently, there are 4 values per individual post.

What I would like to do is order these custom field values in the following order:

  • Height
  • Fueled By
  • Favorite Quote
  • Areas of Expertise

If you go through these pop-ups, you'll see that a couple of them don't follow the same order for some reason and I can't figure out how to control how they display.

To call this slider, here's the query:

    <ul id="lawyers">
    <?php query_posts('post_type=lawyers&orderby=date&order=DESC&posts_per_page=-1'); while (have_posts()): the_post(); ?>
        <li>
            <a href="#<?php the_ID(); ?>" class="fancybox"><?php the_title(); echo the_category(); if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?></a>
            <div id="<?php the_ID(); ?>" class="profile"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('large', array('class' => 'baseball')); } ?><h3><?php the_title(); ?></h3><?php echo(the_meta()); ?></div>
        </li>
    <?php endwhile; ?>
</ul>

Does it have something to do with the_meta()? [1]: http://kunzlerip.com

micah
  • 235
  • 4
  • 12