bp_nouveau_theme_cover_image( array $params = array() )
BP Nouveau’s callback for the cover photo feature.
Description
Parameters
- $params
-
(Optional) The current component's feature parameters.
Default value: array()
Return
(string)
Source
File: bp-templates/bp-nouveau/includes/functions.php
function bp_nouveau_theme_cover_image( $params = array() ) {
if ( empty( $params ) ) {
return '';
}
// Avatar height - padding - 1/2 avatar height.
$avatar_offset = $params['height'] - 5 - round( (int) bp_core_avatar_full_height() / 2 );
// Header content offset + spacing.
$top_offset = bp_core_avatar_full_height() - 10;
$left_offset = bp_core_avatar_full_width() + 20;
$cover_image = isset( $params['cover_image'] ) ? 'background-image: url( ' . $params['cover_image'] . ' );' : '';
$hide_avatar_style = '';
// Adjust the cover photo header, in case avatars are completely disabled.
if ( ! buddypress()->avatar->show_avatars ) {
$hide_avatar_style = '
#buddypress #item-header-cover-image #item-header-avatar {
display: none;
}
';
if ( bp_is_user() ) {
$hide_avatar_style = '
#buddypress #item-header-cover-image #item-header-avatar a {
display: block;
height: ' . $top_offset . 'px;
margin: 0 15px 19px 0;
}
#buddypress div#item-header #item-header-cover-image #item-header-content {
margin-left:auto;
}
';
}
}
return '
/* cover photo */
#buddypress #header-cover-image {
height: ' . $params['height'] . 'px;
' . $cover_image . '
}
' . $hide_avatar_style . '
#buddypress div#item-header-cover-image h2 a,
#buddypress div#item-header-cover-image h2 {
color: #fff;
text-rendering: optimizelegibility;
text-shadow: 0px 0px 3px rgba( 0, 0, 0, 0.8 );
margin: 0 0 .6em;
font-size:200%;
}
#buddypress #item-header-cover-image #item-buttons {
margin: 0 0 10px;
padding: 0 0 5px;
}
#buddypress #item-header-cover-image #item-buttons:after {
clear: both;
content: "";
display: table;
}
@media screen and (max-width: 782px) {
#buddypress #item-header-cover-image #item-header-avatar,
.bp-user #buddypress #item-header #item-header-cover-image #item-header-avatar,
#buddypress div#item-header #item-header-cover-image #item-header-content {
width:100%;
text-align:center;
}
#buddypress div#item-header #item-header-cover-image #item-header-content,
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
margin:0;
}
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
max-width: 100%;
}
#buddypress div#item-header-cover-image h2 a,
#buddypress div#item-header-cover-image h2 {
color: inherit;
text-shadow: none;
margin:25px 0 0;
font-size:200%;
}
#buddypress #item-header-cover-image #item-buttons div {
float:none;
display:inline-block;
}
#buddypress #item-header-cover-image #item-buttons:before {
content:"";
}
#buddypress #item-header-cover-image #item-buttons {
margin: 5px 0;
}
}
';
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.