How to update BuddyPress cover image size?
How to update BuddyPress cover image size? Just copy and paste the codes below to your functions.php
add_filter( 'bp_before_xprofile_cover_image_settings_parse_args', 'swifter_xprofile_cover_image', 10, 1 );
function bp_legacy_theme_cover_image_css_2( $settings = array() ) {
$theme_handle = 'bp-child-css';
$settings['theme_handle'] = $theme_handle;
$settings['callback'] = 'bp_legacy_theme_cover_image_2';
return $settings;
}
function bp_legacy_theme_cover_image_2( $params = array() ) {
if ( empty( $params ) ) {
return;
}
$url = $params['cover_image'];
if( empty( $params['cover_image'] ) ){
$url = get_bloginfo( 'url' ) . '/wp-content/uploads/banner-bg.png'; // you have to change the default image
return '#buddypress #header-cover-image { height: ' . $params["height"] . 'px; background-image: url(' . $url . '); background-repeat-x: repeat; background-repeat: repeat-x; background-size: auto; }';
}
return '#buddypress #header-cover-image { height: ' . $params["height"] . 'px; background-image: url(' . $url . '); }';
}
function swifter_xprofile_cover_image( $settings = array() ) {
$settings['width'] = 1600;
$settings['height'] = 320;
$settings['callback'] = 'bp_legacy_theme_cover_image_2';
return $settings;
}
