Set default BuddyPress Cover Images for groups

Home Forums Gwangi – Dating & Matchmaking Community Theme Compatible Plugins BuddyPress Set default BuddyPress Cover Images for groups

This topic contains 10 replies, has 2 voices, and was last updated by  themosaurus 2 days, 15 hours ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #3932

    alex
    Participant
    • 187 Posts
    @abourne

    I used the BP codex, but did not apply:

    function your_theme_xprofile_cover_image( $settings = array() ) {
        $settings['default_cover'] = 'https://www.gymr.com.au/wp-content/uploads/2018/11/41a4fa77-d87c-4e32-bcdc-14badfad6a33.jpg';
     
        return $settings;
    }
    add_filter( 'bp_before_groups_cover_image_settings_parse_args', 'your_theme_xprofile_cover_image', 10, 1 );

    Then used this, also failed:

    // Default group cover image
    function custom_default_group_cover_image( $settings = array() ) {
        $settings['default_cover'] = 'https://www.gymr.com.au/wp-content/uploads/2018/11/41a4fa77-d87c-4e32-bcdc-14badfad6a33.jpg'; // path to your image
     
        return $settings;
    }
    add_filter( 'bp_before_groups_cover_image_settings_parse_args', 'custom_default_group_cover_image', 10, 1 );
    

    Please suggest if something should be otherwise.

    #3934

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    Hi @abourne,

    These snippets are correct. It’s just the priority of the filters that must be adjusted (10 -> 20, already done in your snippets).

    Regards,

    #3957

    alex
    Participant
    • 187 Posts
    @abourne

    Ta da, easy fix. Thanks.

    #3958

    alex
    Participant
    • 187 Posts
    @abourne

    Why is this not working? I set priority from 10, to 20 and then 30 – none worked…

    function bb_cover_image( $settings = array() ) {
        $settings['width']  = 949;
        $settings['height'] = 712;
     
        return $settings;
    }
    add_filter( 'bp_before_groups_cover_image_settings_parse_args', 'bb_cover_image', 10, 1 );
    

    My default image are these exact dimensions.

    When deactivating code or activating it – no changes are made to image size on groups – hence not working properly.

    Thanks again.

    #3994

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    Hi @abourne,

    How do you want your cover image to be displayed? Do you want it to be fully visible?

    #4005

    alex
    Participant
    • 187 Posts
    @abourne

    Correct, to not be cut off by the page elements and to be displaying in full height.

    #4065

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    Hi @abourne,

    Here is a CSS snippet that will display your cover image in full:

    @media (min-width: 1200px) {
    	#buddypress div#item-header #header-cover-image {
    		height: 840px !important;
    		background-position: center center;
    	}
    	#buddypress div#item-header #profile-header {
    		height: 600px !important;
    	}
    }

    Regards

    #4095

    alex
    Participant
    • 187 Posts
    @abourne

    Applied this. It makes the dimensions of every cover photo placement container from any group push way lower down screen – hence cutting off cover pic and group info which makes the user need to scroll a little.

    The intent is not to change the layout of cover image size on all groups, rather just make this particular image as a default fit into the
    exact dimensions of the existing cover image placement container.

    Should it be best to just resize this image? I tried forever in paint – random dimensions to get it to fit. Failed.

    [‘width’] = 949;
    [‘height’] = 712;
    Is the original size of image

    What should this image be resized too in order to fit within the existing position/placement/container of cover images.

    Or should the above CSS be altered?

    Regards

    #4099

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    Hi @abourne,

    To get your default image to fit, you would indeed need to resize it. Your image needs to have the same (or similar) ratio as the cover container. For instance, the default cover size on our demo is 1800 x 500, so you should try to resize your image to fit these dimensions or have the same or similar ratio.

    I hope this information will help.

    Regards

    #4118

    alex
    Participant
    • 187 Posts
    @abourne

    Okie dokie. Thanks for the support 🙂

    #4123

    themosaurus
    Keymaster
    • 1225 Posts
    @themosaurus

    You’re welcome alex. 🙂

    Best regards,

Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘Set default BuddyPress Cover Images for groups’ is closed to new replies.