Return to Snippet

Revision: 26506
at April 29, 2010 14:08 by Overdeath


Initial Code
<?php
$pagelist = get_pages("child_of=".$post->post_parent."&parent=".$post->post_parent."&sort_column=menu_order&sort_order=asc");
  if (count($pagelist)>0) { ?>
  <h2>Subpages</h2>
  <ul>
  <?php 
  foreach ($pagelist as $page) {
  if (strlen(get_the_title($page->ID)) > 30 ) $titlu=substr(get_the_title($page->ID), 0, 30).'...';
    else $titlu=get_the_title($page->ID);
    if ($page->ID != $post->ID)
    echo '<li><a href="'.get_permalink($page->ID).'" title="'.get_the_title($page->ID).'">'.$titlu.'</a></li>';
    else echo '<li>'.get_the_title($page->ID).'</li>';
    print "\n";
}
  ?>
  </ul>
  <?php 
}
?>

Initial URL

                                

Initial Description
Must be placed after the_post() so make sure you verify that if you place it in the sidebar.

Initial Title
Wordpress - List page children in a list without the link to the current page

Initial Tags
wordpress

Initial Language
PHP