Forums

Join
bbPress Support ForumsTroubleshootingQuery to get wp page menu in bbpress

Info

Query to get wp page menu in bbpress

  1. 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?

  2. This looks pretty similar to what you are doing:
    http://bbpress.org/forums/topic/latest-wordpress-stories

    It's latest stories not a page menu, but still, it's querying WordPress from within bbPress.

  3. You must log in to post.