wp list pages with permalinks
-
Hi,
I’m working with wordpress as a cms so I only have pages and not posts. On my pages I also have permalinks switched on so my pages don’t have ID’s anymore they have actual names.
My problem is I want to list all sub-pages of a parent page and currently I can’t seem to get my code to work correctly. I’m using a plugin to execute the php in a page (exec-php I believe).
<?php // use wp_list_pages to display parent and all child pages all generations (a tree with parent) $parent = [what do I put here???]; $args=array( 'child_of' => $parent ); $pages = get_pages($args); if ($pages) { $pageids = array(); foreach ($pages as $page) { $pageids[]= $page->ID; } $args=array( 'title_li' => 'Tree of Parent Page ' . $parent, 'include' => $parent . ',' . implode(",", $pageids) ); wp_list_pages($args); } ?>This is the code I’m using straight from the WordPress documentation. If I replace ‘What do I put here?’ with a 0 it displays all my pages of the site.
Help much needed tnanks.
DD
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘wp list pages with permalinks’ is closed to new replies.