Retrieves a list of all membership levels passed through the filter: wlmapi_the_levels. If no filter is applied, this function will return the unfiltered array, i.e. the same output as wlmapi_get_levels.
Parameters
This function accepts no parameters.
Return
Returns a string containing the filtered list.
Example Code
<?php //On the page displaying the levels $levels = wlmapi_the_levels(); echo $levels; //In theme functions file or plugin function filter_levels($levels) { //Navigate down to the levels array $levels_array = $levels['levels']['level']; //Start output $output = '<ul>'; //Loop through levels to get level name foreach ( $levels_array as $level ) { $output .= '<li>' . $level['name'] . '</li>'; } //End output $output .= '</li>'; return $output; } add_filter('wlmapi_the_levels', 'filter_levels'); ?>
Example Output
- Test Level 1
- Test Level 2
- Test Level 3
Notes
This functions returns WLMAPIMethods::the_levels() in core/api-helper/class-api-methods.php