Troubles using wp_list_pages
-
Hey guys,
I’ve got some issues using the wp_list_pages template tag twice on one HTML page, once in the page.php and once in the sidebar.php (doesn’t matter if hardcoded or as widget).
First thing I would like to do is a “table of content” with all subpages of the current page:
$sub_pages = wp_list_pages('title_li=&child_of='.$post->ID.'&sort_colum=post_name&echo=0'); if($sub_pages) { echo '<div style="border: 1px solid red; margin: 10px auto; width: 90%;">'; echo '<div style="margin: 10px; font-weight: bold;">Inhaltsverzeichnis <span style="font-weight: normal;">[<a href="#" onclick="switchDirectory();" id="switcher">Anzeigen</a>]</span></div>'; echo '<ol id="directory" class="directory-hide">'; echo $sub_pages; echo '</ol>'; echo '</div>'; }
Second thing is a list will alle subpages of the post->parent page in the Sidebar:
<li> <ul> <?php $related_pages = wp_list_pages('title_li=&depth=1&child_of='.$post->post_parent.'&sort_colum=post_name&echo=1'); ?> </ul> </li>
If I execute both scripts for its own, they work perfect. But if I have both on one page, the HTML output stops directly before the second call.
Unfortunately there are no PHP errors and the $post variable is correct.
Anyone an idea what the problem can be?
THX in advance!
Cheers
Whooper
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Troubles using wp_list_pages’ is closed to new replies.