Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // http://www.gravityhelp.com/forums/topic/changing-the-background-color-of-a-post
- // filter the body class
- add_filter( 'body_class', 'adzoom_wishlist_member_classes' );
- // function to add body class based on wishlist member weekly, 180 day or 365 day
- function adzoom_wishlist_member_classes ($classes) {
- // grab the current user's wishlist member levels
- global $current_user;
- $user_id = $current_user->ID;
- $levels = wlmapi_get_member_levels($user_id);
- $levels = $levels['levels']['level'];
- // these three if statements will all run, no matter what, in case there are multiple membership levels possible for a member?
- // not sure if that's possible, but the wlmapi_get_member_levels returns an array, which could be multiple membership levels
- // add the membership levels to the body class
- if(in_array(365, $levels)) {
- // add 'year-member' to the $classes array
- $classes[] = 'year-member';
- }
- if(in_array(180, $levels)) {
- // add 'half-year-member' to the $classes array
- $classes[] = 'half-year-member';
- }
- if(in_array('weekly', $levels)) {
- // add 'week-member' to the $classes array
- $classes[] = 'week-member';
- }
- // return the $classes array no matter what
- return $classes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement