The following does not work right out of the box and the page takes forever to load, it creates a lot of Apache processes and consumes memory and CPU like crazy
<?php
/**
* Template Name: Custom forum index
*/
get_header();
?>
<div id="content" role="main">
<?php //do_action( 'bbp_template_notices' ); ?>
<?php
$args = array(
'post_type' => 'forum',
'post_status' => 'publish',
//'meta_key' => 'age',
'orderby' => 'title',
'order' => 'ASC',
// 'meta_query' => array(
// array(
// 'key' => '_bbp_topic_count'
// ),
// array(
// 'key' => '_bbp_reply_count'
// ),
// array(
// 'key' => '_bbp_last_active_time'
// ),
// array(
// 'key' => '_bbp_last_topic_id'
// )
// )
);
$query = new WP_Query($args);
while ($query->have_posts()) : the_post(); ?>
<div id="forum-front" class="bbp-forum-front">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php //the_content(); ?>
<?php //bbp_get_template_part( 'content', 'archive-forum' ); ?>
</div>
</div><!-- #forum-front -->
<?php endwhile; ?>
</div><!-- #content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
The underlying motivation is that that I'm trying to create a custom forum index page on which forums are laid out alphabetically based on their names. Strangely, such functionality does not come with bbPress
As you see above, I attempted to use WP_Query() to loop through the post with type "forum". What could have gone wrong with such approach? What do I need to do use to WP_Query() here?