PHP error using page.php for archive-forum.php
-
When I try to access mysite.com/forums it does not work with my theme so I copied archive-forum.php to my child theme.
The default archive-forum.php template allows the bbpress content to appear, but not the theme header, so I stripped away the bbpress header items and replaced ‘archive-forum’ with ‘page’ like so:
<?php get_header(); ?> <div id="forum-front" class="bbp-forum-front"> <div class="entry-content"> <?php bbp_get_template_part( 'content', 'page' ); ?> </div> </div><!-- #forum-front --> <?php do_action( 'bbp_after_main_content' ); ?> <?php get_sidebar(); ?> <?php get_footer();
This makes the theme header work, but now the bbpress content is broken.
I am getting the following error:
Warning: count(): Parameter must be an array or an object that implements Countable in public_html/wp-includes/post-template.php on line 316
The line in question is:
if ( $elements['page'] > count( $elements['pages'] ) ) { // if the requested page doesn't exist $elements['page'] = count( $elements['pages'] ); // give them the highest numbered page that DOES exist }
From what I understand
/forums
is not a page that ‘exists’, but I’ not comfortable modifying WP core. Any help would be appreciated…
- You must be logged in to reply to this topic.