problem while showing category wordpress

1

I'm developing a theme for Wordpress my menu is generated as follows in header.php

<li><a href="<?php echo get_option('home');?>">Início</a></li>
     <?php wp_list_categories('title_li=&orderby=id'); ?>
     <?php wp_list_pages('title_li=&order=id'); ?>

The problem is that when I access a category when trying to show the posts it returns all posts and not the category.

category.php

<?php if ( have_posts() ) : ?>
  <?php while ( have_posts() ) : the_post(); ?>
    <?php the_title(); ?>
  <?php endwhile; ?>
<?php endif; ?>
    
asked by anonymous 29.05.2015 / 18:27

2 answers

1

I solved the problem with wp_reset_query(); missing at the end of header.php

    
29.05.2015 / 19:21
1

Do this:

<?php
   query_posts("category_name=SUA_CATEGORIA");
   while(have_posts()) : the_post();
?>

<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<?php
  endwhile;
  wp_reset_query();
?>
    
29.05.2015 / 18:34