Category ID not being recognized in query_posts
-
I’m using the following page template to pull in some posts at the end of a page using a custom field called ‘categoryid’. Similar code is working on a different site but not on this one for some reason.
<?php /* Template Name: Category Articles Page */ ?> <?php get_header(); ?> <div id="container"> <div id="right-container"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post"> <h2><?php the_title(); ?></h2> <?php if(!is_paged()) { ?> <?php the_content('Read the rest of this page »'); ?> <?php edit_post_link('edit', '<p>', '</p>'); ?> <?php } ?> <?php $categoryid = get_post_meta($post->ID, 'categoryid', $single = true); ?> </div> <?php endwhile; endif; ?> <?php $queryarg = array( 'posts_per_page' => 20, 'cat' => $categoryid, 'paged'=>$paged, ); query_posts($queryarg); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!-- do some things here for each post --> <?php endwhile; endif; ?> <div class="navigation"> <?php posts_nav_link(' · ', 'previous page', 'next page'); ?> </div> </div> <div id="left-container"> <?php get_sidebar(); ?> </div> </div> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Category ID not being recognized in query_posts’ is closed to new replies.