PageTemplate with Single Page entry & Several Categories
-
Hi, the page template code below used to work as I desired (even though it looks a little odd) – after an upgrade to 2.6 – it no longer works: I’ve checked the codex for deprecated code and think I need to use multiple loops and multiple queries – I’ve tried some but no luck:
So I need a page template which displays it’s own text, followed by all posts from 1, 2 or 3 categories.
Any help would be gratefully received.
<?php /* Template Name: exhibition */ get_header(); ?> <div id="bloque"> <div id="noticias"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="entrada"> <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2> <?php the_content("Continue reading ".the_title('', '', false)."..."); ?> <?php edit_post_link('edit', '<p>', '</p>'); ?> <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?> </div> <?php endwhile; endif; ?> <h2>select portfolio</h2> <?php query_posts('cat=21'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); if ( in_category(21) ) { } else { ?> <div class="entrada"> <h3 id="post-<?php the_ID(); ?>"><?php the_title(); ?> » <a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link to <?php the_title(); ?>">read article</a></h3> <small>posted by <?php the_author(); ?> on <?php the_time('F j, Y \a\t\ g:i a'); ?></small> <?php //the_content("more..."); ?> <?php the_excerpt(); ?> <?php edit_post_link('edit', '<p>', '</p>'); ?> <?php link_pages('<p><strong>pages:</strong> ', '</p>', 'number'); ?> </div> <?php } ?> <?php endwhile; endif; ?> <?php query_posts('cat=22'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h2>upcoming</h2> <?php if ( in_category(22) ) { } else { ?> <div class="entrada"> <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?> » <a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link to <?php the_title(); ?>">read article</a></h2> <small>posted by <?php the_author(); ?> on <?php the_time('F j, Y \a\t\ g:i a'); ?></small> <?php //the_content("more..."); ?> <?php the_excerpt(); ?> <?php edit_post_link('edit', '<p>', '</p>'); ?> <?php link_pages('<p><strong>pages:</strong> ', '</p>', 'number'); ?> </div> <?php } ?> <?php endwhile; endif; ?> </div> <?php get_footer(); ?>
- The topic ‘PageTemplate with Single Page entry & Several Categories’ is closed to new replies.