Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I edit the size and style of each forum separately?

Viewing 4 replies - 1 through 4 (of 4 total)

  • Robin W
    Moderator

    @robin-w

    each forum will show a forum ID eg

    <div id=”post-2921″ class=”post-2921 forum type-forum status-publish hentry”>

    So yes you can, but unless you’re familiar with things like firebug and CSS, then you’ll need experienced help.


    DigitalNinjaZA
    Participant

    @digitalninjaza

    I am familiar with firebug and css, not a pro, but def familiar! How can I do this? Please


    Robin W
    Moderator

    @robin-w

    ok, so 3 stages

    1. create the style.css entries – say you have a forum called ‘fred’ you might want to create a ‘fred’ style and have content for this eg

    .fred #fixed-background { background: url(‘http://www.mysite.com/wp-content/uploads/2015/02/fredbackground.jpg&#8217;); }

    2. look up the forum’s ID

    go to dashboard>forums>all forums and hover over the ‘edit’

    at the bottom of the screen you’ll see

    http://www.mysite.com/wp-admin/post.php?post=2921&action=edit

    in this case 2921 is the forum ID

    3. add the style to the body class for that forum

    Add this into your functions file

    function rew_add_class ($classes, $bbp_classes, $wp_classes, $custom_classes ) {
    	//the above line pulls in the pre-existing values so we don't lose them - ie run this function using this existing $variables if they exist
    	//then we check is this is a forum using a bbpress function
    	if ( bbp_is_single_forum() ) {
    	$bbp_forum_id = bbp_get_forum_id();
    	if ($bbp_forum_id == 2922) $custom_classes[] = 'fred' ;
    	if ($bbp_forum_id == 2923) $custom_classes[] = 'george' ;
    }
    
    	//then we check is this is a topic using a bbpress function
    	if ( bbp_is_single_topic() ) {
    	//and if so look up the forum id of that topic
    	$bbp_forum_id = bbp_get_topic_forum_id();
    	//now you will need to add lines for each forum you have and say which class class you want to use, these are just example lines.  Add one for each forum
    	//the number is the 'page_id' (actually it's the post id !)
    	if ($bbp_forum_id == 2922) $custom_classes[] = 'fred' ;
    	if ($bbp_forum_id == 2923) $custom_classes[] = 'george' ;
    		}
    	//then this gets merges into the existing wordpress and bbpress classes
    	$classes = array_merge (  (array) $classes, (array) $custom_classes ) ;
    	Return apply_filters( 'rew_body_class', $classes, $bbp_classes, $wp_classes, $custom_classes ) ;
    }
    
    add_filter ('bbp_body_class' , 'rew_add_class') ; 
    
    

    Robin W
    Moderator

    @robin-w

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar