Support » Plugin: BuddyPress Docs » How I can get all my Docs ?

  • Hi.
    I need find and show all the docs belonging of a group, and I can’t find a way to bring the ids or all the data

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Cavins

    (@dcavins)

    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

    Hey bro thanks for reply me quickly…
    but now I don’t know how I can add this code into of the view of a group. I hope you can understand me. I wanna put a screenshot and you will can watch my objective.
    how i can put a pic here ?

    Plugin Author David Cavins

    (@dcavins)

    It sounds like you’re just trying to move doc functionality into groups. If that’s the case, try this plugin:
    https://github.com/boonebgorges/buddypress-docs-in-group

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How I can get all my Docs ?’ is closed to new replies.