WordPress Code Snippets to get Parent Child Relationship

Advantages of Using this code snippets Not only this shows the parent child relationship if used properly with breadcrumb navigation, can help in maitaining proper silo strucuture within the website. Silo is quiet a key and integral part of SEO.

[code language="php"]
<?php
$parent = $post->ID; // get the id of current page
$child_pages = wp_list_pages("title_li=&child_of=".$parent."&echo=0&sort_column=post_date"); // sort by date and output as li elements
if ($child_pages) { ?>
<ul class="wrapper-nav">
<?php echo $child_pages; ?>
</ul>
<?php } ?>
[/code]
Advantages of Using this code snippets

Not only this shows the parent child relationship if used properly with breadcrumb navigation, can help in maitaining proper silo strucuture within the website. Silo is quiet a key and integral part of SEO.

About Author

Robin Thebe

Digital Strategist based in Sydney.

I am multi disciplined web developer based in Sydney focusing around website design, wordpress development, SEO, SEM and Email Marketing.