Add featured image display to member detail pages
authorLaury GvR <laury@gaslightmedia.com>
Thu, 12 Sep 2019 12:33:31 +0000 (08:33 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 12 Sep 2019 12:33:31 +0000 (08:33 -0400)
functions.php

index 39b3442..b9333ba 100644 (file)
@@ -183,12 +183,16 @@ endif;
 function glm_get_header() {
     echo '<div class="interior-featured"';
 
-    if (has_post_thumbnail()) {
-            $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
-            echo ' style="background-image: url('.$image_data[0].');height:100%;padding-bottom:33%;background-position:center center;background-size: 100%;background-repeat:no-repeat; "';
+    if (is_member()) {
+        $member_id = get_member_data("id");
+        $member_featured_image = apply_filters('member_images', $member_id, true);
+        echo ' style="background-image: url('.$member_featured_image.');height:100%;padding-bottom:33%;background-position:center center;background-size: 100%;background-repeat:no-repeat; "';
+    } else if (has_post_thumbnail()) {
+        $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
+        echo ' style="background-image: url('.$image_data[0].');height:100%;padding-bottom:33%;background-position:center center;background-size: 100%;background-repeat:no-repeat; "';
     } else {
-            echo ' style="background:transparent;height:100%;padding:0;padding-bottom:0;background-position:center center;background-size: 100%;background-repeat:no-repeat;"';
-            echo ' class="no-featured"';
+        echo ' style="background:transparent;height:100%;padding:0;padding-bottom:0;background-position:center center;background-size: 100%;background-repeat:no-repeat;"';
+        echo ' class="no-featured"';
     }
     echo '>';
     echo '</div>';