I'm a C programmer, konw little about PHP. I built a Blog with wordpress.
Yestoday, I try to create the page www.abc.com/server, this page would list all posts which belong to server category.
I found some useful information in wordpress document and Google
I created a template like this:
<?php
/*
* Template name: list_catetory
*/
?>
<?php get_header(); ?>
...
<?php
query_posts( 'cat_name = $pagename' );
if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="post-list" id="post-<?php the_ID(); ?>">
<h2>
<a href="<?php the_permalink() ?>" title=""><?php the_title(); ?></a>
....
</h2>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
...
<?php get_footer(); ?>
I create a page named server with this template.
then I open this page, I found this page list all post.
Why it lists all post, not only list the posts belong to server category