I'm trying to turn paging of WordPress into a category.php file for a theme, but the paging links do not appear. For the little I researched, it would have something to do with using custom queries, but I did not quite understand its usage.
How could I enable paging (either native or with the WP PostNavi plugin) in the code on my page, shown below?
<?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(); ?>