Search Results for 'code'
-
Search Results
-
Out of the box, bbpress shows topics from a particular forum when you are on that forum’s archive page. Makes sense. If that forum has a sub-forum, it will link to those sub-forums, but it won’t show the actual topics from that sub-forum.
I’m trying to modify the default bbpress loop on a forum page (loop-topics.php) to include the sub-forum topics.
Here’s an explanation:
Forum A
Sub-forum A1
Sub-forum A2
Forum B
Sub-forum B1
Sub-forum B2
So when viewing Forum A’s archive page, I’d like to show topics from Forum A, sub-forum A1 and sub-forum A2.The code needs to be dynamic in order to work with whatever parent forum archive a user is on.
You can pass wp_query args into bb_has_topics(), but I can only only come up with code that shows topics from one forum – not multiple forums.
To better explain what I’m working with, here’s an example of a loop that grabs topics from the parent forum:
<?php $parents = get_post_ancestors( $post->ID ); $id = ($parents) ? $parents[count($parents)-1]: $post->ID; $parent = get_page( $id ); ?> <?php $bbp_loop_args = array('post_parent' => $parent->ID, 'post_type' => 'topic'); ?> <?php if ( bbp_has_topics($bbp_loop_args) ) : ?> <?php while ( bbp_topics() ) : bbp_the_topic(); ?> <?php bbp_get_template_part( 'loop', 'single-topic' ); ?> <?php endwhile; ?> <?php endif;?>Any ideas on how this can be achieved?
I wonder if i could add a function that displays a topic starter label for any topic author in a topic.
It would be cool so that say 5 pages in a topic, you could always know who started the topic if they kept the conversation going.
I know the function would most likely be put in a theme
functions.phpbut i wonder if it could go intoloop-single-reply.phpI feel like the function would use the topic started by function, mainly
get_topic_author<span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?></span>IT would be a nice feature to have
any help??



