How To Show Category Posts In Sidebar
-
I’m struggling with the PHP for a query I’d like to put in my sidebar to show posts with the Category ‘Featured’ based on the current Category.
This is what I have:
<?php if ( have_posts() ) { the_post(); rewind_posts(); } ?> <?php if (is_home()) { ?> <!-- no featured posts --> <?php } else { ?> <?php if (in_category('London & Brighton Marathons')) { query_posts('cat=4,5'); } ?> <!-- featured posts --> <h2>Featured Posts</h2> <ul> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul> <?php endif; ?>
Internet Explorer tells me I’ve got a parse error, but I can’t see what’s wrong with it. Can anyone else? Any help would be gratefully appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How To Show Category Posts In Sidebar’ is closed to new replies.