Query to get wp page menu in bbpress
-
I have wp and bbpress succesfully integrated. Now in my bbpress forum I’d like to display the wordpress pages. Basicly I want to replicate wp_list_pages() from wp. I know there’s a way to include wp in total inside bbpress. but that has a performance penalty and I’m also afraid it might cause bugs in the future.
So I’d prefer a simple query. What I have thus far:
global $bbdb;
$query = "SELECT wp_posts.*
FROM wp_posts
WHERE wp_posts.post_status = 'publish'
AND wp_posts.post_type = 'page'
ORDER BY wp_posts.post_date DESC ";
$results=$bbdb->get_results($query);
foreach($results as $result) {
echo '<li><a href="' . $result->guid . '">' . $result->post_name . '</a></li>';
}But I need a query which replicates wp_list_pages() closer. Where can I find that function in wordpress? Or how could I improve my query so that I get the subpages as well, for example?
- You must be logged in to reply to this topic.