Hello, good morning.
Well, I'm having trouble sorting posts in wordpress categories.
Ex: I have the category news, movies, music, images .. I want to sort the posts of these categories in ascending order. I used the following code
<?php query_posts("order=ASC"); ?>
But instead of showing just the posts linked to the category, it pulls all posts from the site.
I also used
$args = array('post_type'=>'post','orderby'=> 'title', 'order' => 'ASC');
The same problem occurred, instead of listing the category posts in ascending order, it lists all posts.
The complete code for category.php
is this:
<?php if ( have_posts() ) : ?>
<header class="container">
<?php
the_archive_title( '<h1 class="text-center">', '</h1>' );
the_archive_description( '<h4 class="text-center">', '</h4>' );
?>
</header><!-- .page-header -->
<section class="categorias">
<div class="container">
<?php while ( have_posts() ) : the_post();?>
<?php if (get_post_meta($post->ID, 'reservado', true) == 'no'): ?>
<div class="col-md-4">
<h3>
<a href="<?php echo get_permalink();?>">
<?php the_title();?>
</a>
</h3>
<?php echo odin_thumbnail(400, 200, true, 'minha-classe' ); ?>
</div>
<?php endif ?>
<?php endwhile; ?>
<div class="col-md-12">
<div class="text-center">
<ul class="pagination">
<li><?php echo paginate_links(); ?></li>
</ul>
</div>
</div>
<?php else:?>
<div class="col-md-12 text-center">
<h1>Não existem pontos nesta semana</h1>
<img src="/logo.png" class="img-responsive">
<?php get_search_form(); ?>
</div>
<?php endif; ?>
</div>
</section>
Thanks in advance for your attention!