Is it possible to loop through the
the_post_navigation()
<div class="case-nav hidden-xs">
<?php the_post_navigation( array(
'prev_text' => __( 'Previous post'),
'next_text' => __( 'Next post'),
)); ?>
</div>
Okay, I solved it myself, in a different way. But the result is the same!
<!-- Navigation -->
<div class="case-nav hidden-xs">
<?php the_post_navigation( array(
'prev_text' => __( 'Vorig bericht'),
'next_text' => __( 'Volgend bericht'),
)); ?>
</div>
<div class="case-nav visible-xs">
<?php the_post_navigation( array(
'prev_text' => __( 'Vorige'),
'next_text' => __( 'Volgende'),
)); ?>
</div>
<?php
// Get first post
$args = array(
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'ASC',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'post_status' => 'publish',
'suppress_filters' => true
);
$posts_array = get_posts( $args );
$firstPost = get_permalink($posts_array[0]->ID);
//Get latest post
wp_list_pages('title_li=&depth=1');
query_posts('posts_per_page=1');
if(have_posts());
while(have_posts()) :
the_post();
$lastPost = get_permalink();
endwhile;
wp_reset_query();
?>
<script type="text/javascript">
var itemNext = "<?php echo $firstPost; ?>";
var itemPrev = "<?php echo $lastPost; ?>";
// remove nav line if nav item doesn't exist
if(!$('.nav-previous').length){
$('.nav-links').append('<div class="nav-previous"><a href="' + itemNext + '" rel="prev">Vorig bericht</a></div>');
} else if(!$('.nav-next').length){
$('.nav-links').append('<div class="nav-next"><a href="' + itemPrev + '" rel="next">Volgend bericht</a></div>');
} else{}
// -- remove nav line if nav item doesn't exist
</script>