WordPress – Add sub-menu links to page

How do you add links to sub-menu pages?

 This is especially important with responsive designs where mobile layouts do not have drop-down menus. Of course WordPress has an easy answer.

 

// add this to page.php

<?php
    // http://www.optiniche.com/blog/369/sub-page-links/
    $children = wp_list_pages(‘title_li=&child_of=’.$post->ID.’&echo=0′);
    if ($children) { ?>
    <div class=”widget widget_pages jsmenu jswidget”><ul>
    <?php echo $children; ?>
    </ul></div>
<?php } ?>

 

83 views

Need help? Let me take care of your IT issues.

Share this page

Scroll to Top