Estou tentando ativar a paginação do WordPress em um arquivo category.php de um tema, mas os links de paginação não aparecem. Pelo pouco que eu pesquisei, teria algo a ver com o uso de custom queries, mas eu não compreendi bem o seu uso.
Como eu poderia ativar a paginação (seja nativa ou com o plugin WP PostNavi) no código da minha página, mostrado abaixo?
<?php get_header(); ?>
<main>
<div id="content_internas">
<div id="lista_noticias">
<h2><span><?php echo strtoupper(single_cat_title( '', false )) ?></span></h2>
<ul>
<?php $posts = get_all_posts(null, get_cat_id( single_cat_title("",false) )); ?>
<?php foreach($posts as $key => $post): ?>
<li>
<a href="<?php the_permalink() ?>">
<?php if (function_exists('has_post_thumbnail')) {
if (has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(460, 300, true)); ?></a>
<?php } } ?>
</a>
<br />
<span><?php the_time('j F') ?></span>
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<p><?php the_excerpt(); ?></p>
</li>
<?php endforeach; ?>
</ul>
<div class="paginacao">
<?php if(function_exists('wp_pagenavi')) : ?>
COM PLUGIN
<?php wp_pagenavi() ?>
<?php else : ?>
SEM PLUGIN
<div class="maisantigos"><?php next_posts_link(__('« Mais antigos','arclite')) ?></div>
<div class="maisrecentes"><?php previous_posts_link(__('Mais recentes »','arclite')) ?></div>
<?php endif; ?>
</div>
<!--<center><a href="#" id="veja_mais">MAIS NOTÍCIAS</a></center>--><br> <br>
</div>
</div>
</main>
<?php get_footer(); ?>