Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to specify an ID with “bp_has_activities”

  • @eigodeasobo

    Participant

    I want to restrict the activities to the one with the ID specified in advance when outputting.

    That is, I want to execute the following with the specified ID.

    <?php bp_get_template_part( 'activity/entry' ); ?>

    However, it did not work in “WP_Query” as follows.

    <?php
    $IDs = array(1,2,3);
    $args = array( 'post__in' => $IDs );	
    $the_query = new WP_Query( $args );
    ?>
    
    <?php if ( $the_query->have_posts() ) : ?>
    	
    	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    	
    	<?php bp_get_template_part( 'activity/entry' ); ?>
    		
    	<?php endwhile; ?>
    
    <?php endif;?>

    How can I display the activity with the specified ID?

Viewing 2 replies - 1 through 2 (of 2 total)
  • @shanebp

    Moderator

    Activity items are not posts.
    Use the proper function: bp_has_activities().
    Look it up to find out how to pass in an array of arguments.

    @eigodeasobo

    Participant

    can you explain to me in a little more detail please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar