bp_legacy_theme_cover_image

BP Legacy's callback for the cover image feature.

Description

(array) bp_legacy_theme_cover_image( (array) $params = array() ); 

Returns (array)

an array to inform about the css handle to attach the css rules to

Parameters (1)

0. $params — Optional. (array) => array()
The current component's feature parameters.

Usage

  1. if ( !function_exists( 'bp_legacy_theme_cover_image' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-templates/bp-legacy/buddypress-functions.php'; 
  3.  
  4. // the current component's feature parameters. 
  5. $params = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_legacy_theme_cover_image($params); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-templates/bp-legacy/buddypress-functions.php  
  1. function bp_legacy_theme_cover_image( $params = array() ) { 
  2. if ( empty( $params ) ) { 
  3. return; 
  4.  
  5. // Avatar height - padding - 1/2 avatar height. 
  6. $avatar_offset = $params['height'] - 5 - round( (int) bp_core_avatar_full_height() / 2 ); 
  7.  
  8. // Header content offset + spacing. 
  9. $top_offset = bp_core_avatar_full_height() - 10; 
  10. $left_offset = bp_core_avatar_full_width() + 20; 
  11.  
  12. $cover_image = ( !empty( $params['cover_image'] ) ) ? 'background-image: url(' . $params['cover_image'] . ');' : ''; 
  13.  
  14. $hide_avatar_style = ''; 
  15.  
  16. // Adjust the cover image header, in case avatars are completely disabled. 
  17. if ( !buddypress)->avatar->show_avatars ) { 
  18. $hide_avatar_style = ' 
  19. #buddypress #item-header-cover-image #item-header-avatar { 
  20. display: none; 
  21. '; 
  22.  
  23. if ( bp_is_user() ) { 
  24. $hide_avatar_style = ' 
  25. #buddypress #item-header-cover-image #item-header-avatar a { 
  26. display: block; 
  27. height: ' . $top_offset . 'px; 
  28. margin: 0 15px 19px 0; 
  29.  
  30. #buddypress div#item-header #item-header-cover-image #item-header-content { 
  31. margin-left: auto; 
  32. '; 
  33.  
  34. return ' 
  35. /* Cover image */ 
  36. #buddypress #header-cover-image { 
  37. height: ' . $params["height"] . 'px; 
  38. ' . $cover_image . ' 
  39.  
  40. #buddypress #create-group-form #header-cover-image { 
  41. margin: 1em 0; 
  42. position: relative; 
  43.  
  44. .bp-user #buddypress #item-header { 
  45. padding-top: 0; 
  46.  
  47. #buddypress #item-header-cover-image #item-header-avatar { 
  48. margin-top: '. $avatar_offset .'px; 
  49. float: left; 
  50. overflow: visible; 
  51. width: auto; 
  52.  
  53. #buddypress div#item-header #item-header-cover-image #item-header-content { 
  54. clear: both; 
  55. float: left; 
  56. margin-left: ' . $left_offset . 'px; 
  57. margin-top: -' . $top_offset . 'px; 
  58. width: auto; 
  59.  
  60. body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,  
  61. body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions { 
  62. clear: none; 
  63. margin-top: ' . $params["height"] . 'px; 
  64. margin-left: 0; 
  65. max-width: 50%; 
  66.  
  67. body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions { 
  68. max-width: 20%; 
  69. padding-top: 20px; 
  70.  
  71. ' . $hide_avatar_style . ' 
  72.  
  73. #buddypress div#item-header-cover-image .user-nicename a,  
  74. #buddypress div#item-header-cover-image .user-nicename { 
  75. font-size: 200%; 
  76. color: #fff; 
  77. margin: 0 0 0.6em; 
  78. text-rendering: optimizelegibility; 
  79. text-shadow: 0 0 3px rgba( 0, 0, 0, 0.8 ); 
  80.  
  81. #buddypress #item-header-cover-image #item-header-avatar img.avatar { 
  82. background: rgba( 255, 255, 255, 0.8 ); 
  83. border: solid 2px #fff; 
  84.  
  85. #buddypress #item-header-cover-image #item-header-avatar a { 
  86. border: 0; 
  87. text-decoration: none; 
  88.  
  89. #buddypress #item-header-cover-image #item-buttons { 
  90. margin: 0 0 10px; 
  91. padding: 0 0 5px; 
  92.  
  93. #buddypress #item-header-cover-image #item-buttons:after { 
  94. clear: both; 
  95. content: ""; 
  96. display: table; 
  97.  
  98. @media screen and (max-width: 782px) { 
  99. #buddypress #item-header-cover-image #item-header-avatar,  
  100. .bp-user #buddypress #item-header #item-header-cover-image #item-header-avatar,  
  101. #buddypress div#item-header #item-header-cover-image #item-header-content { 
  102. width: 100%; 
  103. text-align: center; 
  104.  
  105. #buddypress #item-header-cover-image #item-header-avatar a { 
  106. display: inline-block; 
  107.  
  108. #buddypress #item-header-cover-image #item-header-avatar img { 
  109. margin: 0; 
  110.  
  111. #buddypress div#item-header #item-header-cover-image #item-header-content,  
  112. body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,  
  113. body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions { 
  114. margin: 0; 
  115.  
  116. body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content,  
  117. body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions { 
  118. max-width: 100%; 
  119.  
  120. #buddypress div#item-header-cover-image h2 a,  
  121. #buddypress div#item-header-cover-image h2 { 
  122. color: inherit; 
  123. text-shadow: none; 
  124. margin: 25px 0 0; 
  125. font-size: 200%; 
  126.  
  127. #buddypress #item-header-cover-image #item-buttons div { 
  128. float: none; 
  129. display: inline-block; 
  130.  
  131. #buddypress #item-header-cover-image #item-buttons:before { 
  132. content: ""; 
  133.  
  134. #buddypress #item-header-cover-image #item-buttons { 
  135. margin: 5px 0; 
  136. ';