I want to set up my template so that Pages show a list of posts where the category slug matches the page slug. So on the Page "About Us" ('about'), posts tagged with the category-slug 'about'. The sidebar should show a list of these posts (I need to hardcode this. NO PLUGINS). Index.php should show all posts, EXcluding the posts that show up on a page.
This is the custom loop generates a list of recent posts that I will be adding to sidebar.php. This needs to be modified so that it only shows posts in a category that matches the page.
<ul> <?php query_posts( 'posts_per_page=5' ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?><li><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li><?php endwhile; endif; wp_reset_query(); ?> </ul>
I tried to explain as clearly as possible, but it's a little confusing, so please me know what I need to make more clear.