marooned
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Fixing WordPress
In reply to: How to loop Previous page Next pageThanks Michael. Yes, I agree, that’s exactly why the error was occurring.
As it was code I’d originally found on the Codex site I was hoping to receive some code suggestions to resolve this here. In the end I’ve used a plugin that I’ve been able to customize, and it resolves itself on the looping issue well.
Forum: Fixing WordPress
In reply to: How to loop Previous page Next pageIt is a custom theme I am developing.
The query is as follows:
<?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 class="pager"> <?php if (!empty($prevID)) { ?> <li class="previous"> <a href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>"> <span aria-hidden="true" class="ion ion-ios-arrow-left icon-md"></span> </a> </li> <?php } if (!empty($nextID)) { ?> <li class="next"> <a href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>"> <span aria-hidden="true" class="ion ion-ios-arrow-right icon-md"></span> </a> </li> <?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)