Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Activity Custom Content After Post Iteration

@tommyhares

Participant
do_action( 'bp_before_activity_loop' ); ?>

<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ):

  if ( empty( $_POST['page'] ) ) : ?>

    <ul id="activity-stream" class="activity-list item-list">

  <?php endif; ?>

  <?php      
    $count = 0;

    $args = array(
      'posts_per_page'   => 100000,
      'offset'           => 0,
      'category'         => '',
      'category_name'    => 'freedom-friend-news',
      'order'            => 'desc',
      'orderby'          => 'date',
      'include'          => '',
      'exclude'          => '',
      'meta_key'         => '',
      'meta_value'       => '',
      'post_type'        => 'post',
      'post_mime_type'   => '',
      'post_parent'      => '',
      'author'	         => '',
      'author_name'	     => '',
      'post_status'      => 'publish',
      'suppress_filters' => true 
    );
    $news_articles = get_posts( $args ); 
          
	while( bp_activities() ): bp_the_activity();

		bp_get_template_part( 'activity/entry' );
          
        $current_user = wp_get_current_user();
        if( $current_user->user_login == 'tommy' ):
          
          $count++;
          $news_iteration = $count / 7)-1;
          
          // Loop through news articles as long as there are articles.
          if( $count % 7 == 0 && !empty( $news_articles[$news_iteration] )):
          
            echo 'News Article';
            echo 'Iteration: '.$news_iteration;
            echo $news_articles[$news_iteration]->post_title;
            echo $news_articles[$news_iteration]->post_excerpt;
      
          endif;
            
        endif;

	endwhile; ?>

	<?php if ( bp_activity_has_more_items() ) : ?>

		<li class="load-more">
			<a href="<?php bp_activity_load_more_link() ?>"><?php _e( 'Load More', 'buddypress' ); ?></a>
		</li>

	<?php endif; ?>

	<?php if ( empty( $_POST['page'] ) ) : ?>

		</ul>

	<?php endif; ?>

<?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; ?>
Skip to toolbar