/ Published in: PHP
this is pretty useful if you want to use the wordpress blog system to feed a custom application/site of yours
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
to test it, put this in "wp-content/themes/[theme name]/header.php" //------------------------------------------------------------- // pagesRecursive // lists pages of a WP recursively //------------------------------------------------------------- function pagesRecursive($parentId, $lvl){ $pages = get_pages($args); if ($pages) { $lvl ++; foreach ($pages as $page) { print "<div style='margin-left:".($lvl * 30)."; border:solid 1px #000; margin-bottom:10px; '>"; print $page->ID."<br>"; print $page->post_date."<br>"; print $page->post_title."<br>"; print $page->post_content."<br>"; print "</div>"; pagesRecursive($page->ID, $lvl); } } } pagesRecursive(20, 0);