Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP child theme causes profile cover image to disappear


  • shirleyddsn
    Participant

    @shirleyddsn

    Hello, I’m working on a buddypress site, and I finally figured out how to create a child theme and a css file that I can use to customize the way my buddypress looks. I was so excited, I almost didn’t notice that my profile header went missing. After some debugging, I realized that simply copying over the bp-legacy css file into my child theme css folder is what caused the header to disappear.

    I’ve looked through old answers to try and solve the problem on my own, however, I don’t understand the code itself, how it works or even where it’s supposed to go.

    topic where I got the code -> CSS causing cover image to disappear.

    The code suggested –

    function your_theme_cover_image_css( $settings = array() ) {
        /**
         * If you are using a child theme, use bp-child-css
         * as the theme handel
         */
        $theme_handle = 'bp-parent-css';
    
        $settings['theme_handle'] = $theme_handle;
    
        /**
         * Then you'll probably also need to use your own callback function
         * @see the previous snippet
         */
         $settings['callback'] = 'bp_legacy_theme_cover_image';
    
        return $settings;
    }
    add_filter( 'bp_before_xprofile_cover_image_settings_parse_args', 'your_theme_cover_image_css', 10, 1 );
    add_filter( 'bp_before_groups_cover_image_settings_parse_args', 'your_theme_cover_image_css', 10, 1 );

    Is this code up to date? Where is it even supposed to go? I tried placing it in my parent theme’s functions.php file. Am I supposed to have a functions.php file in my child theme?

    Also, in case it’s important, I’m currently using the GeneratePress free theme, but I’m likely not going to stay with it. This is currently just for testing purposes.

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

  • shirleyddsn
    Participant

    @shirleyddsn

    Side Note:
    I dont know if I can/should ask this here, or if it should be a different post, but I’m trying to make changes to the buddypress templates in my child theme, and it seems that I’m not allowed (?!) to make changes to the actual templates?

    For example, I was trying to make changes to cover-image-header.php just to see if I can. I wanted to add “Last Active:” just before the function that lists when the member was last active. Just to see if I could. When I refreshed the page, I thought I saw for a brief second that it did in fact say “Last Active:”, before it disappeared and just showed the original content again. To make sure it was actually my code and not a glitch, I repeated the process but replaced LAST ACTIVE with PIZZA HUT. Just to make sure it was actually me. Refresh -> Pizza Hut flashed. Yup, it was me. But why wont the code stick? Could it be my child theme document tree isn’t right? Or do I need to add some code somewhere so that changes in my child folder override files in the original buddypress folders?

    When I copied my files over, I group selected the folders in plugins/buddypress/bp-templates/bp-legacy/buddypress and copied them all over to themes/my-theme/buddypress. Am I missing a folder or something?

    Also: I figured out the concept behind add_action tacking on instructions to a do_action function. But where do the DO_ACTION functions live? And am I able to modify those? I would like to add some font-awesome icons to the front of my profile menu links the way we have here, but I can’t find the code that spits out the information.


    shirleyddsn
    Participant

    @shirleyddsn

    UPDATE: I found this topic -> Editing BuddyPress Core Files Within Child theme That suggested that I should have a buddypress folder inside my child theme directory, and that all my copied files should go in THERE! I made the change, but I still can’t update any of the actual files. I tried my PIZZA HUT test again, but this time nothing flashed on the screen. So I guess that’s not it?

    BTW – I’m just going to keep posting updates as I go so that when someone shows up, they’ll have current information on what I’ve tried. Maybe save some time that way.


    shirleyddsn
    Participant

    @shirleyddsn

    Another Update:

    Ok, I was finally able to create a change in the file I was trying to edit. For some reason, I wasn’t able to insert code in the exact place I was trying to last time, but I WAS able to add code elsewhere in the document.

    Also, I noticed the name of the hook started with “bp”, so I moved my cover-image code to my bp-custom.php file in my child theme. But it didn’t work there either. I feel like there’s something else I’m supposed to do with $settings['callback']. Or maybe I’m supposed to plug some more code in elsewhere. I could really use some help with this.

    Also, while playing with the profile templates, I noticed there were a few hooks (which I’m learning are the ‘actions’ I’m adding to) that don’t really seem to do anything but sit there. Do they exist only for me to add code to through my bp-custom.php? If so, why wouldn’t I just hard-code something into the template file?

    For example: do_action( 'bp_member_header_actions' ); sits between the @username and last-activity. But it’s empty. When the profile page loads, there’s nothing there. So that would make it an empty hook for me to plug stuff into, right? bp_profile_header_meta is also empty. Are all hooks like that? Or do any of them have their own code/functions?

    I would still like to know where these actions are declared, and what possible functions lie inside them. Is there any way to find that information out? People create their own BP themes and plugins all the time so there has to be a way to figure this stuff out . . .

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