I had a pagination for only one category “procesos”, this was the code:
<?php if(has_term('procesos', 'dslc_projects_cats')): ?>
<?php
$args = array(
'posts_per_page' => 7,
'post_type' => 'dslc_projects',
'tax_query' => array('dslc_projects_cats', 'field' => 'id', 'terms' => 'procesos')
);
$processes = get_posts($args);
$ids = array();
foreach ($processes as $process) {
$ids[] += $process->ID;
}
$thisindex = array_search($post->ID, $ids);
//var_dump($ids);
$previd = $ids[$thisindex-1];
$nextid = $ids[$thisindex+1];
?>
<div class="row">
<div class="container inner-pagination">
<div class="col-xs-6">
<?php
if(!empty($previd))
echo '<a rel="prev" href="'.get_permalink($previd).'"> « '.get_the_title($previd).'</a>';
?>
</div>
<div class="col-xs-6 text-right">
<?php
if(!empty($nextid))
echo '<a rel="next" href="'.get_permalink($nextid).'">'.get_the_title($nextid).' » </a>';
?>
</div>
</div>
</div>
<?php endif; ?>
The pagination only appears in post with category “procesos”, I modified code to:
<?php
$args = array(
'posts_per_page' => 13,
'post_type' => 'dslc_projects',
);
$processes = get_posts($args);
$ids = array();
foreach ($processes as $process) {
$ids[] += $process->ID;
}
$thisindex = array_search($post->ID, $ids);
//var_dump($ids);
$previd = $ids[$thisindex-1];
$nextid = $ids[$thisindex+1];
?>
The rest is the same, and now i have pagination in all the posts and is continue (without categorization): http://globalarmor.com.mx/project-view/desmontaje/
I want the pagination by category, like was before, but in all the categories (there are four). How can I achieve this?