Advertisement
Guest User

Untitled

a guest
Mar 10th, 2017
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.22 KB | None | 0 0
  1. do_action( 'bp_before_activity_loop' ); ?>
  2.  
  3. <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ):
  4.  
  5.   if ( empty( $_POST['page'] ) ) : ?>
  6.  
  7.     <ul id="activity-stream" class="activity-list item-list">
  8.  
  9.   <?php endif; ?>
  10.  
  11.   <?php      
  12.     $count = 0;
  13.  
  14.     $args = array(
  15.       'posts_per_page'   => 100000,
  16.       'offset'           => 0,
  17.       'category'         => '',
  18.       'category_name'    => 'freedom-friend-news',
  19.       'order'            => 'desc',
  20.       'orderby'          => 'date',
  21.       'include'          => '',
  22.       'exclude'          => '',
  23.       'meta_key'         => '',
  24.       'meta_value'       => '',
  25.       'post_type'        => 'post',
  26.       'post_mime_type'   => '',
  27.       'post_parent'      => '',
  28.       'author'           => '',
  29.       'author_name'      => '',
  30.       'post_status'      => 'publish',
  31.       'suppress_filters' => true
  32.     );
  33.     $news_articles = get_posts( $args );
  34.     $counter = 1;      
  35.     while( bp_activities() ): bp_the_activity();
  36.     if ( 0 === $counter % 5 ) {
  37.         // Do something here.
  38.     }
  39.         bp_get_template_part( 'activity/entry' );
  40.          
  41.         $current_user = wp_get_current_user();
  42.         if( $current_user->user_login == 'tommy' ):
  43.          
  44.           $count++;
  45.           $news_iteration = $count / 7)-1;
  46.          
  47.           // Loop through news articles as long as there are articles.
  48.           if( $count % 7 == 0 && !empty( $news_articles[$news_iteration] )):
  49.          
  50.             echo 'News Article';
  51.             echo 'Iteration: '.$news_iteration;
  52.             echo $news_articles[$news_iteration]->post_title;
  53.             echo $news_articles[$news_iteration]->post_excerpt;
  54.      
  55.           endif;
  56.            
  57.         endif;
  58.     $counter++
  59.     endwhile; ?>
  60.  
  61.     <?php if ( bp_activity_has_more_items() ) : ?>
  62.  
  63.         <li class="load-more">
  64.             <a href="<?php bp_activity_load_more_link() ?>"><?php _e( 'Load More', 'buddypress' ); ?></a>
  65.         </li>
  66.  
  67.     <?php endif; ?>
  68.  
  69.     <?php if ( empty( $_POST['page'] ) ) : ?>
  70.  
  71.         </ul>
  72.  
  73.     <?php endif; ?>
  74.  
  75. <?php else : ?>
  76.  
  77.     <div id="message" class="info">
  78.         <p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ); ?></p>
  79.     </div>
  80.  
  81. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement