disabling sidebards for some Buddpress group

HI,

Is there a plugin or known hack to disable sidebars for a specific Buddypress group in Blogs MU theme?

Thanks.

Sezen.

  • Ash
    • WordPress Hacker

    Hello @Sezen

    I hope you are well today and thanks for asking the question.

    Please add the following code in the theme's functions.php file before ?>

    add_action('wp_head', 'hide_sidebar');
    function hide_sidebar() {
        $array = array(2, 5, 9, 18);
        $guid = bp_get_current_group_id();
        if(in_array($guid, $array)){
            ?>
            <style>
                #sidebar{display: none;}
                #content, #post-entry{
                    width: 100% !important;
                    float: none !important
                }
            </style>
            <?php
        }
    }

    You need to change the $array here. You need to use those group IDs in the array where you want to hide the sidebar.

    Please let me know if you find this is helpful, or if you have any further questions.

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    Use this:

    add_action('wp_head', 'hide_sidebar');
    function hide_sidebar() {
        $array = array(2, 5, 9, 18);
        $guid = bp_get_current_group_id();
        if(in_array($guid, $array)){
            ?>
            <style>
                #sidebar{display: none;}
                #content, #post-entry{
                    width: 100% !important;
                    float: none !important;
                    border-left: none !important;
                }
            </style>
            <?php
        }
    }

    It should work.

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    No, it should work.

    Did you add just border-left: none !important; or copy from my last post?

    Please copy from my last post as there is another change too, a semicolon is added after float: none.

    Please check and let me know.

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    Can I take a look in your site?

    Would you please grant support access from your Dashboard > WPMU DEV > Support > Support Access so that I can check?

    Alternatively, send me login details.

    To send me details, please use our contact form: https://premium.wpmudev.org/contact/

    Select: I have a different question
    Subject: Attn-Ash
    Details: Send all required details (admin info and/or ftp details) with a link of this thread, so that I can track.
    Also post a note here once you send the info.

    I will be happy to take a look :slight_smile:

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    Ahh, I see now. You are using sidebar in right side but I was using in left side.

    Use the following:

    add_action('wp_head', 'hide_sidebar');
    function hide_sidebar() {
        $array = array(2, 5, 9, 18);
        $guid = bp_get_current_group_id();
        if(in_array($guid, $array)){
            ?>
            <style>
                #sidebar{display: none;}
                #content, #post-entry{
                    width: 100% !important;
                    float: none !important;
                    border-right: none !important;
                }
            </style>
            <?php
        }
    }

    It should work :slight_smile:

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.