Skip to:
Content
Pages
Categories
Search
Top
Bottom

CSS display: none question


  • OC2PS
    Participant

    @sooskriszta

    I’m technically illiterate so need some help understanding this.

    On the bbPress pages, I am using CSS to hide sidebar…something like

    .bbp-forum #primary {
    display: none;
    }

    My question is: Is the sidebar is still loaded (on server, in browser) and just not displayed, or do I by simply styling it out of view also save some time on page loading?

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

  • Jared Atchison
    Moderator

    @jaredatch

    No its definitely still being rendered by the server and the browser, your browser just hides it. Ideally you’ll want to find a way to nuke the sidebar on bbPress pages, but you’ll have to poke around your theme to do that.


    martin_style
    Member

    @martin_style

    If you using method that, you have to load all information in one page, once time load slow, but not loading multiple times


    OC2PS
    Participant

    @sooskriszta

    Thanks guys!

    @martin_style: Not quite sure what you mean by “once time load slow, but not loading multiple times”

    @jaredatch: How do I nuke the sidebar?

    I lied. I am not using

    .bbp-forum #primary {
    display: none;
    }

    I am using a plugin that replaces primary sidebar with a bbpress specific sidebar.

    But I have 2 sidebars, and I am hiding the 2nd sidebar with CSS

    .bbp-forum #secondary {
    display: none;
    }

    So this is the one that I need to remove.

    I am guessing that instead of fiddling with the Theme, it might be easier to patch the plugin. Here’s what it does at the moment:

    function vp_sidebars_widgets($data)
    {
    // if bbpress enabled and main sidebar requested
    if ($this->is_bbp && $this->is_main_sidebar)
    {
    // switch sidebar if bbrepss sidebar has some widgets in it
    if (!empty($data[$this->sidebar_id]))
    {
    if (isset($data['sidebar-1']))
    {
    // uses sidebar-1 as main sidebar in most themes
    // set forum sidebar as main sidebar
    $main_sidebar_key = 'sidebar-1';
    }
    else
    {
    // get first sidebar which should be main in most themes
    foreach ($data as $k => $v)
    {
    if (strpos($k,'inactive')===false)
    {
    $main_sidebar_key = $k;
    break;
    }
    }
    }

    // replace main sidebar with bbpress sidebar
    if (isset($main_sidebar_key))
    {
    $data[$main_sidebar_key] = $data[$this->sidebar_id];
    }
    }

    // reset main sidebar request
    $this->is_main_sidebar = false;
    }

    // return modified widgets array
    return $data;
    }


    Jared Atchison
    Moderator

    @jaredatch

    It depends on what theme you are using.

    Theme’s typically call and register sidebar’s differently, which is why it is easier to fix this on a theme level and not a plugin.

    Find out how your theme is handling sidebars, write mini plugin or block in your functions.php that addresses the issue.

    We’ve been down this road already :P

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

You must be logged in to reply to this topic.