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 } ?>

 

40 views

Need help? Let me take of your IT issues.

Share this page

Share on facebook
Share on linkedin
Share on twitter
Share on print
Share on email
Scroll to Top

By continuing to use this website, you consent to the use of cookies in accordance with our Cookie Policy