Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi I am trying to create a buddypress theme and I kind of figured out how to do it but I need to create an activity loop that displays only 4 activities.Now if I wanted to do this in a normal wordpress loop I would I have done this:

query_posts(array(
              'posts_per_page'=>'3',
              'post-type'=>'post',
              'paged' => get_query_var('paged')
             )           
        );

I have tryed this in the activity looop but this does not work.This is the loop I created for the activity stream:

<?php if ( bp_has_activities() ) : ?>  
                        <ul id="activity-stream" class="activity-list item-list">  
                        <?php while ( bp_activities() ) : bp_the_activity(); ?>  

                            <li class="<?php bp_activity_css_class() ?>" id="activity-<?php bp_activity_id() ?>">  

                                <div class="activity-avatar">  
                                    <a href="<?php bp_activity_user_link() ?>">  
                                        <?php bp_activity_avatar( 'type=full&width=40&height=40' ) ?>  
                                    </a>  
                                </div>  

                                <div class="activity-content">  

                                    <div class="activity-header">  
                                        <?php bp_activity_action() ?>  
                                    </div>  

                                    <?php if ( bp_get_activity_content_body() ) : ?>  
                                        <div class="activity-inner">  
                                            <?php bp_activity_content_body() ?>  
                                        </div>  
                                    <?php endif; ?>  

                                    <?php do_action( 'bp_activity_entry_content' ) ?>  

                                </div>  
                            </li>  

                        <?php endwhile; ?>  

                        </ul>  

                     <?php else : ?>  
                        <div id="message" class="info">  
                            <p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ) ?></p>  
                        </div>  
                     <?php endif; ?>  
                </div>

What do I need to modify in order to display only the lates 4 activities?

share|improve this question

closed as off-topic by Pieter Goosen, toscho Jul 2 at 14:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

See the codex: http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/

You probably want this:

<?php if ( bp_has_activities( 'max=4') ) : ?>
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.