I have created a custom post type in WordPress, and one of the fields is brewing company. I would like to be able to arrange the post by that field.
Something like this:
Brewing Company - Country
Beer Name, Beer Type
All of the fields are working properly, but I can't figure out how to create the correct loop. Here is my loop section for my beers page.
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<?php query_posts( get_post_meta( $post->ID, 'Query', true )); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ); ?>
<ul><span class="brewing-company"><?php echo get_post_meta($post->ID, 'brewing_company', true); ?></span> - <?php echo get_post_meta($post->ID, 'brewing_country', true);?>
<?php the_post();?>
<li> <?php the_title(); ?>, <span class="beer-style"><?php echo get_post_meta($post->ID,'beer_style', true); ?></span></li>
<?php endwhile; ?>
</ul>
<?php endif; wp_reset_query(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyeleven' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
The Query parameter comes from another meta value on the beers page. That is equal to post_type=beer&showposts=100&order_by=get_post_meta($post->ID, 'brewing_company', true).
Any help would be greatly appreciated. You can see my current progress at http://drewclardy.com/beers