Код: Выделить всё
$args_rel = array(
'posts_per_page' => 10,
'order' => 'DESC',
'orderby' => 'ID',
'post_type' => 'answer'
);
$wpex_query = new wp_query( $args_rel );
foreach( $wpex_query->posts as $post ){
setup_postdata( $post );
$tags = get_the_tags();
echo '' . get_the_title() . '
' . get_field('name') . ' answered
';
foreach ( $tags as $tag ) {
echo "{$tag->name}";
}
echo '';
}
$total_pages = $wpex_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
echo '';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => '/page/%#%',
'current' => $current_page,
'total' => $total_pages,
'prev_text' => __('«'),
'next_text' => __('»'),
));
echo '';
}
wp_reset_postdata();
Подробнее здесь: https://stackoverflow.com/questions/795 ... pagination