• I want to display a page’s subpages if it has any, and if there are no subpages, i want to display some text.

    Im trying this code but can not get it to work, it keeps displaying the “text if else” even if there ARE subpages. Help?

    <ul>
      <?php
    
    global $id;
    $vm = wp_list_pages("title_li=&child_of=$id&show_date=modified&date_format=$date_format");
    if ($vm) {$vm;}
    else { echo 'text if else'; };
    
    ?>
    </ul>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if page has subpages … else …’ is closed to new replies.