bbPress

Simple, Fast, Elegant

bbPress support forums » Themes

Different Backgrounds

(3 posts)
  • Started 3 months ago by McKrazie
  • Latest reply from sambauers
  • This topic is not resolved
  1. Hello,

    I am currently in developement of a theme for a gaming group's website that I maintain. We play multiple games and I wanted to have different backgrounds get picked randomly for the site and then if you select one of the games in their given section ... it would pick that game background for that page. Perhaps, if I could for that game's forum also on bbPress.

    I know this may be a lot to ask of a PHP script but is there anything out there?

    To help aid in any responces here is my idea overviewed:

    Parent Link - Randomly picked background from backgrounds database
    Games > Warcraft - Warcraft background
    Forums - Randomly picked background from backgrounds database
    Warcraft Forums - Warcraft background

    Any ideas?

    Posted 3 months ago #
  2. It can be done with PHP.

    I've never done the random thing, but the Cutline theme for WordPress offers this functionality. You can read about it here:
    http://cutline.tubetorial.com/totally-random-header-images-for-cutline/

    I think you could adapt that for your uses.

    In WordPress, for a specific background tied to a specific page, I just do something like this in header.php:

    <div id="container" style="background: #fff url('<?php bloginfo('template_directory'); ?>/images/<?php echo $post->ID; ?>.jpg') left top no-repeat;">

    That gives the container div the background image of the post ID.jpg, so if you were viewing post 52, you would have a background image of 52.jpg. You could easily adapt this to bbPress calls by using the forum number and $forum_id, whichever div you want a background for (#wrapper or #main?) and then the proper location of your images (whether they are stored in your template folder or your forum root or something.) It fails OK too since there is a color code for the background and that is used if the image cannot be found (I think that's what happens anyway.)

    Let me know if that makes sense. This is how I've done it in WordPress, but the same approach will work for bbPress I think.

    Posted 3 months ago #
  3. This would be pretty easy to do within a theme.

    Posted 3 months ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.