Fixed Background… Fixed!

Bingo!  We have a winner!  “Fixed” goes BEFORE “center top,” not after!

So, if you were Googling and couldn’t find the answer (as I couldn’t), and you are trying to add a fixed (non-scrolling) background to your WordPress blog using the ChocoTheme (and it will probably work with other themes), then you need to modify your functions.php file as indicated below.

}
function choco_get_body_style() {
$bg_color = get_option(‘background_color’, ‘#3A2820’);
$bg_image = get_option(‘background_image’);
$bg_repeat = get_option(‘background_repeat’);

$style = ‘background: ‘ . $bg_color;
if ($bg_image) {
$style .= ‘ url(‘ . $bg_image . ‘) fixed center top ‘ . $bg_repeat;
}
$style .= ‘;’;

return $style;
}

Okay, now I’m happy!

Except… Now I have to tackle that “Random Photo” thumbnail that is too big for the sidebar.  Now I have to decide whether I want to decrease the size of the thumbnail or increase the size of the sidebar…  Hmm…

1 Response

Leave a Reply