function not executing
-
hello I am turning a PHP into a function to be executed on a page template, the code when itself is run through directly from the template file works but when I create a function in code snippets and call it on the page template it breaks
this is the codefunction getPrevNext(){ $pagelist = get_pages("child_of=".$post->post_parent."&parent=".$post->post_parent."&sort_column=menu_order&sort_order=asc"); $pages = array(); foreach ($pagelist as $page) { $pages[] += $page->ID; } $current = array_search($post->ID, $pages); $prevID = $pages[$current-1]; $nextID = $pages[$current+1]; echo '<div class="navigation">'; if (!empty($prevID)) { echo '<div class="alignleft">'; echo '<a href="'; echo get_permalink($prevID); echo '"'; echo 'title="'; echo get_the_title($prevID); echo'">Previous</a>'; echo "</div>"; } if (!empty($nextID)) { echo '<div class="alignright">'; echo '<a href="'; echo get_permalink($nextID); echo '"'; echo 'title="'; echo get_the_title($nextID); echo'">Next</a>'; echo "</div>"; } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘function not executing’ is closed to new replies.