Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Remove theme sidebar

  • Avatar of Famous
    Famous
    Participant

    @famous

    What is the best way to remove the theme sidebar when showing the member single profile page? So on my website I am using a theme that has a sidebar and I want it there, but on the member page I don’t want it there.

    Current setup: 1.7
    myTheme/buddypress/members/single/home.php

    However I don’t see a sidebar call in home.php.

Viewing 18 replies - 1 through 18 (of 18 total)
  • Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Are you using BP 1.7 on a WP theme?

    First, read through hnla’s doc on theme compatibility:

    http://codex.buddypress.org/developer/theme-development/a-quick-look-at-1-7-theme-compatibility/

    After you’ve read it, follow these instructions.

    Copy `page.php` and rename it to `buddypress.php.`  Now edit this file and remove `get_sidebar()` and make any additional changes you want and then save.

    Avatar of Famous
    Famous
    Participant

    @famous

    I meant to say, my home.php is located here:
    childTheme/buddypress/home.php
    from here:
    /bp-legacy/buddypress/members/single

    per modemloopers instructions

    And that works fine, but doing what you said above does not seem to work? I have twentytwelve as my theme, with a child theme of twentytwelve. So I took page.php from theme twentytwelve and put it here:
    childTheme/buddypress/page.php
    and also tried:
    childTheme/buddypress/buddypress.php

    But I must be missing something cause I removed the sidebar

    but its still showing. I read the instructions but???

    Thanks

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    What theme are you using for the parent?

    If it is not bp-default, `buddypress.php` should reside at `wp-content/themes/child-theme/`.  Not in a subdirectory of your theme.

    Avatar of Famous
    Famous
    Participant

    @famous

    Twentytwelve

    K not sure what happened but that part works. Now its the CSS that I don’t fully comprehend. I uploaded:
    childTheme/css/buddypress.css

    and in it I placed code to override the themes content because the sidebar is now missing, but I have a width of 65%, which no longer makes sense, but it doesn’t seem to override it? Any ideas.

    Thanks

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    If you want to remove the sidebar for user account screens then you can wrap the get_sidebar() in

    `if( bp_is_user() ) :`

    Not sure why running the buddypress.php in the /buddypress/ folder isn’t working it’s meant to and does on my local install.

    Avatar of Famous
    Famous
    Participant

    @famous

    @hugo Please re-read my last post. What I need to do is change the CSS for the main theme site content because it is at 65% without the sidebar and now needs to be 100% to compensate for the missing sidebar, But not sitewide just for the members single page

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Look at the body class, a while back I had a class added to core to establish a class token for user account screens ‘bp-user’ iirc; you can use that as the ancestral selector in a descendent selector group to style on:

    .bp-user #content {}

    Avatar of Famous
    Famous
    Participant

    @famous

    Ok so this needs to be revisited cause I didn’t get it to work correctly. I have an MU site, and when I put buddpress.php in buddypress directory:
    /childTemplate/buddypress/buddypress.php

    It cancels out my homepage sidebar?

    How am I supposed to do this to remove the sidebar from the member homepage only?

    Thank you

    Avatar of Famous
    Famous
    Participant

    @famous

    My question is, how is your plugin supposed to handle the integration. What is the correct way to remove the sidebar from the member profile only, on an MU site running twentytwelve.

    wp-content/themes/child-theme/buddypress/buddypress.php
    the above does not work. @hnla

    wp-content/themes/child-theme/buddypress.php
    the above does not work. @r-a-y

    So if you could point me to the solution that 1.7 addressed that would be great. Thanks

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    wp-content/themes/child-theme/buddypress/buddypress.php
    the above does not work. @hnla

    Works for me mate.

    I told you earlier how to place a conditional check on the get_sidebar()

    Avatar of Famous
    Famous
    Participant

    @famous

    That if statement includes a sidebar if I am a BP user, but for everyone else it won’t show the sidebar. I kinda need the reverse; if is an BP user then do not show. And would I place that code where?

    childTheme/buddypress/members/single/home.php

    Because that is the only page I do not want the sidebar. By the way what would be my best procedure because I don’t really like messing with core files?

    Thanks

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    hmm it’s a typo ?? try adding a ! at the front of the function.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    You don’t edit core files ever, and don’t need to the template overrides should be working if not then something else is up or not correct in what you’re doing.

    Avatar of Famous
    Famous
    Participant

    @famous

    Can someone please tell me step for step, how to get rid of the sidebar on the members page only ?

    I am using an MU site with theme TwentyTwelve.

    Thank you

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    hnla is absolutely correct.

    You can place `buddypress.php` in the `buddypress` subdirectory.

    You can treat `buddypress.php` like any other template.

    So what you want to do is do a conditional check to see if you’re on a profile page.

    Since you only want to show the sidebar on non-member pages, you could use the following code snippet:

    `<?php if ( ! bp_is_user() ) { get_sidebar(); } ) ?>`

    This snippet should replace the `get_sidebar()` line in your `buddypress.php` template.

    Avatar of Famous
    Famous
    Participant

    @famous

    So that didn’t work either as the code shows up incorrect, however it did lead me in the right direction:

    which worked for me, so thanks. This worked as well:

    `.bp-user #content {}`

    however not in the intended /buddypress/buddypress.css, but it did work in:

    the childTheme/styles.css

    So thanks. I am guessing not too many users are actually using 1.7 as it was intended because there would be a lot more problems with this.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Sorry to hear that you’re experiencing problems, Famous.

    It’s working for me.

    This is what I have in `wp-content/themes/twentytwelve/buddypress/buddypress.php` to remove the sidebar on profile pages, but have it show up on all other pages:

    http://pastebin.com/NyTN9pkj

    This will remove the sidebar on profile pages, but you’ll still need to adjust the CSS so the content is full-width.

    Avatar of Famous
    Famous
    Participant

    @famous

    Thanks R-A-Y thats what I ended up using after you pointed me in the right direction.

    Post thread solved x

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

You must be logged in to reply to this topic.