Loop through a single category, sort results by meta_value_num
-
I’m at a loss for why this custom loop isn’t working. Its just supposed to loop through a single category, display post thumbnail and excerpt, and sort by a meta_value_num. The sort isn’t included yet, since the basic loop itself is currently not showing anything on the page.
Why won’t this code display posts in the ‘clients’ category?
How would I make it order those posts via meta_value_num?Thank you in advance!
<?php /* Template Name: Our Clients */ get_header();?> <!-- BEGIN OF PAGE TITLE --> <?php if (have_posts()) : ?> <div id="page-title"> <div id="page-title-inner"> <div class="title"> <h1><?php the_title();?></h1> </div> <div class="dot-separator-title"></div> <div class="description"> <!--[if IE]> <style type="text/css"> .description {margin-top:30px;} </style> <![endif]--> <?php global $post;?> <?php $short_desc = get_post_meta($post->ID, '_short_desc', true ); ?> <p><?php echo $short_desc;?></p> </div> <div class="clear"></div> </div> <div class="clear"></div> </div> <!-- END OF PAGE TITLE --> <div id="content"> <div id="content-left"> <div class="maincontent"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php if(is_category('client')): ?>class="client-post" <?php endif;?>> <div class="blog-posted"> <div class="image-left"> <?php the_post_thumbnail( 'thumbnail' ); ?> </div> <!-- This is the output of the EXCERPT --> <div class="entry-summary"> <?php the_excerpt(); ?> </div> </div> </article> <?php endwhile; else: ?> <p>Sorry, the client posts cannot be located</p> <?php endif; ?> </div> </div> <?php endif;?> <?php get_sidebar();?> </div> <!-- END OF CONTENT --> <?php get_footer();?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Loop through a single category, sort results by meta_value_num’ is closed to new replies.