Code help for sorting specific category posts by custom field
-
Hi,
I created a template to only list posts in the ‘Entertainment’ category. I wanted to list about 3 posts per page and then have the next button at the bottom. The posts have to be sorted in a certain order so I created a custom field. The following code is only listing the first post without the Next button.
<?php get_header(); ?> <div id="full-content"> <div class="breadcrumbs"> <?php if(function_exists('bcn_display')) { bcn_display(); } ?> </div> <?php query_posts('cat=3&posts_per_page=3'); ?> <?php query_posts('meta_key=ent_order&meta_compare=<=&meta_value=100&orderby=meta_value&order=ASC'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="clearfloat"> <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> </div> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> <?php endwhile; endif; ?> </div> <div class="navigation"> <div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div> <div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div> </div> <?php get_footer(); ?>
Any ideas?
Thank you!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Code help for sorting specific category posts by custom field’ is closed to new replies.