Hello,
If you’d like to run a loop of docs associated with a group (that the current user can view), you can do something like this, adapted from the “recent docs” widget:
<?php if ( bp_docs_has_docs( array( 'group_id' => 7 ) ) ) : ?>
<ul>
<?php while ( bp_docs_has_docs() ) : bp_docs_the_doc(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a>
<?php if ( $show_date ) : ?>
<span class="post-date"><?php echo get_the_date(); ?></span>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
If you’re just trying to find them using WP_Query
, then you’ll need to do a taxonomy query, using something like this for the taxonomy argument:
'tax_query' = array(
'taxonomy' => bp_docs_get_associated_item_tax_name(),
'field' => 'slug',
'terms' => bp_docs_get_term_slug_from_group_id( $group_id ),
);
Best,
-David