Well you just need to run a foreach
loop over your $children
but WordPress has a build in function for this already called wp list pages
.
For example:
$children = wp_list_pages('title_li=&child_of=".$post->ID."&echo=1');
if ($children)
echo '<ul>' . $children . '</ul>';
There is a full reference and examples here: http://codex.wordpress.org/Function_Reference/wp_list_pages
Related Posts:
- Custom Nav Walker Displaying Values in Sub Menu
- Custom Nav Walker to show siblings and children of current branch?
- Create self-populating menu and add extra divs to the menu layout
- wp_post->post_parent object returning 0
- Single-level menu option? Another way?
- Admin: sub menu doesnt display under apperance when activate my themes
- WordPress custom menu can’t show 3. level submenu
- Theme: dropdown hover menu not showing up in IE/Edge
- Show all menu levels except top level. How to exclude top level of a menu?
- WordPress menu walker – Get parent item text inside end_lvl function
- WordPress doesn’t recognize submenus as so I can’t style them properly
- Main Menu Theme Different Output Print
- Add wrapper for a specific sub-menu
- Menu items description? Custom Walker for wp_nav_menu()
- WordPress API Menu/Submenu Order
- How can I display a menu on certain pages only?
- Add custom classes to anchor in wp_nav_menu
- Add Caret to Menu Items with Sub-Menus in WordPress Theme
- How to limit wordpress menu depth in admin panel
- wp_nav_menu sort order?
- How to determine if custom menu is active?
- Any walker causes blank menu?
- How to add menu support to a theme?
- Select menu on browser resize
- Extend walker – navigation, adding data attribute to a tag
- Get last modified date for menu link
- Replace Home with image link inside custom header menu
- How to add nofollow to wp_nav_menu
- How to highlight the current page in the nav menu?
- How do I add a post to a menu
- how to change WordPress menu markup/classes
- Setting a Default ‘Theme Location’ When Creating a Menu
- Best practices: Custom theme sidebar menu – hardcode or widget?
- How do I highlight the menu for a child page?
- how to set more than one menus to the same theme location
- CSS won’t style output of wp_nav_menu() correctly
- Where is definied the theme location for the main menu in a WordPress template?
- how to wrap tag in tag html to wordpress menu conversion
- Second menu not showing
- menu behavior is not as expected
- Set default screen option for appearance -> menus
- Part of Menu Item Hidden on Header Menu
- wp_nav_menu add something before closing container and after last list item
- WordPress empty Nav Menu error
- Primary navigation menu & footer not showing in category / tag page
- Problem with empty class attributes when running a filter on nav_menu_css_class
- Custom Nav Walker Trouble
- How to set the currently active page in the menu including parents
- Issue on Adding A Class to Bootstrap Navbar Walker Dropdown
- Where am I doing wrong in my theme menu?
- Custom Navigation build using wp_nav_menu and walker
- Override customizer values on a per-menu base
- Recommended method for updating/adding menus when adding new theme
- Why wp_nav_menu() doesnt show the proper meny when invoked two consecutive times?
- How to develop a menu like wwe.com?
- Why are some of my menu items not displaying on my menu?
- How should I use starter content utility to show some default menus?
- How to create and populate with few links a menu in child theme functions.php?
- Second menu has the first menu ID
- wp_nav_menu and its fallback
- Thesis -style Navigation
- Use a filter on menu items that have children
- How can i make multilevel menu in wordpress theme with bootstrap
- how do i develop a global nav and local nav to be wordpress dynamic?
- Adding content inside the anchor tags within WordPress main nav
- Why is my container argument not working for wp_nav_menu() [closed]
- How to Emulate Default Navigation Menu Behaviour in a Custom Theme?
- Does wordpress add their own classes into nav menus?
- Custom menu: Link names
- Custom nav menu not showing
- .current_page_ancestor broken in Twenty Eleven
- if (has_custom_menu())?
- Why do sticky posts show in this menu?
- Making a horizontal flyout menu from WordPress category listing
- how to create/register menu items that can be added to menus later
- Why nav_menu_css_class doesn’t work with apply_filters?
- Best way to give user the option to make a menu, mega menu?
- Programatically Created Menu not Editable in Dashboard
- Building a custom menu or use a plugin?
- Use instead of for wp_nav_menu()
- How can I show a custom WordPress menu anywhere I want on my website?
- Cold Fusion to WordPress
- Menu is in Reversed order
- WordPress Menu item > Sub menu Class update
- Menu names not getting translated
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- How to know and change the machine name of a menu?
- wp_nav_menu custom walker class
- How to add custom nav_menu_css_class to certain menu only?
- Menu order of parent menu from perspective of child menu
- How to add drop symbol to parent nav items which have child
- How to add custom field option with menu?
- Horizontal Navigation
- Problem with multiple menus in theme
- Menu item not created on theme activation
- How do I move menu to the bottom in Custom Community theme?
- Header links also appearing in the footer
- Creating Multiple Menus in the Thesis Theme?
- How do I middle-align my header menu items in WordPress [closed]
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?