<?php
$pagelist = get_pages('sort_column=menu_order&sort_order=asc');
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
?>
<div id="page_nav">
<div class="wrapper">
<a href="<?php echo get_permalink($prevID); ?>"><i class="fa fa-arrow-left"></i>Previous Work</a><span>/</span>
<a id="back_link" href="http://kyleskelly.co.uk/#projects_container">Back to Projects</a><span>/</span>
<a href="<?php echo get_permalink($nextID); ?>">Next Work<i class="fa fa-arrow-right"></i></a>
</div>
</div>
My knowledge of php isn’t great, so any help would be appreciated, thanks!
I want my code to query –
IF is first page in portfolio then the a tag for prev link is inactive.
else if last page in portfolio then next page link is inactive.
else the code i already have
I haven’t tried this code, but I think it should work. Please let me know if something arises. I’ve commented the code to explain you more or less what I’ve done.