There is a small change to header.php sometimes, but normally this is already there:
<body <?php body_class() ?>>
That will output all the body classes. Your function should add to the existing body classes. Something like this:
[php]
// filter the body class
add_filter( 'body_class', 'adzoom_wishlist_member_classes' );
// function to add body class based on wishlist member 180 or 365 day
function adzoom_wishlist_member_classes ($classes) {
// read the wishlist member information somehow
$userid = 'how to get userid?';
$key = 'what is the wishlist member key';
$single = true; // probably only want a single piece of information, right?
// get the wishlist member level based on the meta key set above
$wishlistlevel = get_user_meta( $userid, $key, $single );
// pseudocode to add class based on information stored by wishlist member
if ($wishlistlevel == '365') {
// add 'year-member' to the $classes array
$classes[] = 'year-member';
}
else if ($wishlistlevel == '180') {
// add 'half-year-member' to the $classes array
$classes[] = 'half-year-member';
}
// return the $classes array no matter what
return $classes;
}
Then, in style.css you will have some CSS which looks like this":
[css]
body.year-member div#content {
background-color: yellow;
}
body.half-year-member div#content {
background-color: green;
}
If the content area you want to change the background on is not #content, change those lines to match your theme. You might also have to adjust font colors and other things.
See if that gets you going.
(not tested BTW - just roughly how to do it)
Posted 12 years ago on Tuesday July 10, 2012 |
Permalink