Created
December 10, 2014 16:25
-
-
Save bappi-d-great/69866fc0cad2be126d21 to your computer and use it in GitHub Desktop.
Sorting membership in register page for protected content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'ms_model_membership_get_signup_membership_list', 'ms_model_membership_get_memberships_cb', 99, 3 ); | |
function ms_model_membership_get_memberships_cb( $memberships, $exclude_ids, $only_names ) { | |
// This is IMPORTANT. You have to put all child memberships ID in here in the order you want to show. | |
$new_order = array( 262, 266, 263 ); | |
$new_membership = array(); | |
foreach( $memberships as $membership ){ | |
if( in_array( $membership->id, $new_order ) ) { | |
$pos = array_search($membership->id, $new_order); | |
$new_membership[$pos] = $membership; | |
} | |
} | |
ksort( $new_membership ); | |
return $new_membership; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment