You must have Javascript enabled to experience this site.

WordPress – Add sub-menu links to page

Posted & filed under Coding Tips.

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

 

0 views