Category in Page

I hacked into the page.php file, tested for the page I wanted to convert, and added the LOOP code from category.php file to run instead when it hit that page. I also had to reset the query when that occurred.

The pages are kept in the wp_post table and their post_type='page', That’s how I found the page number I wanted to check for.

 <?php if (is_page('738')) : /** Tech Page = post 738 **/ ?>
 <?php /** Change the query before the loop starts for the tech page **/
   /** category tech=4, techb=54 **/
   $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
   query_posts(array('category__in'=>array(4,54),'showposts'=>10, 'paged'=>$page));
   /** query_posts('category_name=techb&showposts=10'); **/ ?>

 <?php if (have_posts()) :  /** THE LOOP - CATEGORY **/ ?>
 ...

The one thing that’s not working is the “older/newer” links at the bottom. They come from the following code, and I’m not sure if I need to change it, or (more likely) change the modified query above to somehow take into consideration what page it’s on. Pagination? Anyone?  Found solution, and included above.

 <ul class="prevnext">
   <li class="newer"><?php previous_posts_link('Newer Posts'); ?></li>
   <li class="older"><?php next_posts_link('Older Posts');?></li>
 </ul>

Leave a Reply

Your email address will not be published. Required fields are marked *