Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@imath
Created July 21, 2013 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imath/6048371 to your computer and use it in GitHub Desktop.
Save imath/6048371 to your computer and use it in GitHub Desktop.
A reply to one of my blog comment to force alphabetical order for bc_members shortcode. See http://imathi.eu/2011/05/15/bowe-codes/comment-page-1/#comment-17190
<?php
/** begining of code to copy paste in functions.php of active theme **/
/**
* Forces the order of bc_members to be alphabetical if an alpha class has been added
*
* Using the class argument of bc_members allows to only filter the members_args
* if the class 'alpha' prepends my_members class. Keeping my_members class will maintain
* css rules.
*
* Example of Bowe Code : [bc_members class="alpha my_members"]
*
* @param array $members_args the args sent to bp_has_members
* @param array $args merge array between default shortcode atts and user args
* @return array the new args to send to bp_has_members
*/
function imath_alphabetical_sort_members( $members_args, $args ) {
if( strpos( $args['class'], 'alpha' ) === 0 )
$members_args['type'] = 'alphabetical';
return $members_args;
}
add_filter( 'bowe_codes_members_tag_args', 'imath_alphabetical_sort_members', 10, 2 );
/** end of code **/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment