I have an array of page ID’s which I need to use to create a simple next/previous page menu.
Below you can see what I have put together so far.
I realize I am not even close here…
<?php
$pagelist = array(0,1358,226,1394,1402,1468,0);
$prevID = prev($pagelist);
$nextID = next($pagelist);
?>
<div class="navigation">
<?php if ($prevID != 0) { ?>
<div class="alignleft">
<a href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">Previous</a>
</div>
<?php } ?>
<?php if ($nextID != 0) { ?>
<div class="alignright">
<a href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">Next</a>
</div>
<?php } ?>
</div><!-- .navigation -->
I think I need to use the current page ID at some point which I get using this function
<?php the_ID(); ?>
Could anybody help point me in the right direction please?
assuming that your URL contain id parameter :
Hope this solution may help you