Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding members header on certain pages


  • The Dux
    Participant

    @duxortus

    Hi.

    Sorry if this has been answered, but how would I hide, or rather stop from being generated in the first place, the members header (avatar and all) for pages like my-messages?

    I know how to with css, but I feel it would be better to stop it from being generated in the first place if possible. Also I need to learn.

    Thanks to whoever takes the time!

Viewing 5 replies - 1 through 5 (of 5 total)
  • On any particular condition other than just messages? If you want to simply remove the item-header you have two choices really, query the page for the component and action being viewed and wrap a conditional around the item-header or using the template hierarchy create a index-messages.php file in your theme adding it into file structure as outlined in the codex guides ‘buddypress/single/members/’ now you can modify this template and remove elements just for that one component view.

    Template Hierarchy


    The Dux
    Participant

    @duxortus

    Thanks for replying. I was thinking of removing, later maybe having an alternate version, header for a number of pages. All messages, inbox, outbox etc. Also notifications, friend requests etc. Pages that will be private to you as a user.

    I have run into something though, I can’t seem to make a hook work?

    function testFunction() {
    echo "Hello World!";
    }
    add_action(‘bp_init’, ‘testFunction’);

    I’ve put this in /plugins/bp-custom.php which also have other functions that does work.


    Henry Wright
    Moderator

    @henrywright

    @duxortus in the code you’ve posted, your single quote marks look weird. Not sure if it’ll matter but they should really be like this:

    '

    Not like this:


    The Dux
    Participant

    @duxortus

    I just figured that out, and yeah, that fixed it. Must have come from some code I copied. Sorry guys. Update on the members-header will follow!

    For anyone wondering I am using a plugin widget I made in the sidebar for all user navigation.

    For now I’m using CSS, as bp does it pretty easy for me:

    body.my-account #item-header, 
    body.my-account #item-nav {
    	display: none;
    }
    
    body.my-profile #item-header {
    	display: initial;
    }

    Osisis
    Participant

    @osisis

    @duxortus were you able to get the code for this worked out? I have WDS BP Framework and an not seeing where the members header is called for in messages.php so I figured I would try the former option Hugo mentioned.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hiding members header on certain pages’ is closed to new replies.
Skip to toolbar