bbp_has_topics has a ‘reset’ in it, it executes
new WP_Query( $r )
what is the loop in your sidebar?
It’s
if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'paged' => 1, 'posts_per_page' => $number_of_topics ) ) ) :
bbp_get_template_part( 'loop', 'mytopics' );
else :
bbp_get_template_part( 'feedback', 'no-topics' );
endif;
without seeing the detail, not sure what you are trying to achieve.
I don’t think this has anything to do with resetting, rather that both queries are doing the same thing. post_parent deafulats to any in many cases.
Try running each individually to see if they produce separate results when only one is run
On the main content (url: forums/topic-tag/android/) is loaded content-archive-topic.php template with following code:
<?php bbp_get_template_part( 'loop', 'topics' ); ?>
loop-topics.php contains
<?php while ( bbp_topics() ) : bbp_the_topic(); ?>
<?php bbp_get_template_part( 'loop', 'single-topic' ); ?>
<?php endwhile;
wp_reset_query();?>
So it loads topics with android tag.
On the sidebar I have this code
if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'paged' => 1, 'posts_per_page' => $number_of_topics ) ) ) :
bbp_get_template_part( 'loop', 'mytopics' );
else :
bbp_get_template_part( 'feedback', 'no-topics' );
endif;
It should load all recent topics from all forums but it loads topics with android tag, and it happens when I’m on this page forums/topic-tag/android/
Interesting… WP_query has a tag parameter, lets try resetting that
Try
if ( bbp_has_topics( array( 'author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'paged' => 1, 'posts_per_page' => $number_of_topics, 'tag' => '') ) ) :
bbp_get_template_part( 'loop', 'mytopics' );
else :
bbp_get_template_part( 'feedback', 'no-topics' );
endif;
I added ‘tag’ => ” and it doesn’t help.
ok, sorry you’ve exhausted my knowledge 🙂