Help with creating a function.
- 
		I was wondering if it’s possible to take the code I have below and make a function that does the exact same thing. This code will grab 16 random members, and insert their avatars with links to their pages: <br />
 <?php if ( bp_has_site_members( 'type=random&per_page=16;' ) ) : ?><br />
 <?php while ( bp_site_members() ) : bp_the_site_member(); ?><br />
 <span class="item-avatar"><br />
 <!-- THE BELOW HAS BEEN QUOTED OUT DO TO IT BEING A LINK, THE REAL CODE NEEDS THIS
 <a>" title="<?php bp_the_site_member_name() ?>"><?php bp_the_site_member_avatar() ?></a><br />
 -->
 </span><br />
 <?php endwhile; ?><br />
 <?php do_action( 'bp_directory_members_featured' ) ?><br />
 <?php else: ?><br />
 <div id="message" class="info"><br />
 <p><?php _e( 'There are not enough members to feature.', 'buddypress' ) ?></p><br />
 </div><br />
 <?php endif; ?><br />I was wondering if I could make a function (maybe in bp-custom.php? or somewhere so that I can insert the code simply by typing in one line of php code. Thanks 
- The topic ‘Help with creating a function.’ is closed to new replies.