From: Anthony Talarico Date: Fri, 3 Nov 2017 20:36:04 +0000 (-0400) Subject: adding featured image header to member detail X-Git-Tag: v1.0.0^2~55 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=e7a8d3d362707511b61a0cb6230a184a7ca7bfb4;p=WP-Themes%2Fmeetingsmichigan.git adding featured image header to member detail member detail page uses the member featured image as the header image for the page --- diff --git a/functions.php b/functions.php index 7bc22b0..3b67c97 100644 --- a/functions.php +++ b/functions.php @@ -18,6 +18,7 @@ if (!function_exists('glm_quicksite_widget_init')) { )); } } + /** * Return the client info option for the given key * @@ -70,12 +71,20 @@ function glm_site_scripts() /* Header for posts*/ -function glm_get_header() { +function glm_get_header($memberID = false) { global $post; + echo 'post_type == 'page'&& !is_page('member-detail')) { + if ((has_post_thumbnail() && $post->post_type == 'page') || is_page('member-detail')) { + if(!$memberID){ $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full"); - echo ' style="background-image: url('.$image_data[0].');height:0;padding:0;padding-bottom:22%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 420px; "'; + $image_data = $image_data[0]; + + } else { + $image_data = apply_filters('member_images',$memberID,true); + } + + echo ' style="background-image: url('.$image_data.');height:0;padding:0;padding-bottom:22%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 420px; "'; } else if (!is_page('member-detail')) { echo ' style="background-image: url('.get_template_directory_uri().'/assets/default-header.jpg);height:0;padding:0;padding-bottom:22%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 420px; "'; } @@ -86,6 +95,17 @@ function glm_get_header() { echo ''; echo ''; } +if (!function_exists('write_log')) { + function write_log ( $log ) { + if ( true === WP_DEBUG ) { + if ( is_array( $log ) || is_object( $log ) ) { + error_log( print_r( $log, true ) ); + } else { + error_log( $log ); + } + } + } +} // // The code below is useful when you want the image to resize to // if (has_post_thumbnail()) { diff --git a/glm-member-db/views/front/members/detail.html b/glm-member-db/views/front/members/detail.html index 4b8facd..2d78388 100644 --- a/glm-member-db/views/front/members/detail.html +++ b/glm-member-db/views/front/members/detail.html @@ -126,14 +126,14 @@ {apply_filters('glm-member-db-front-members-detail-attributesTop', '', $member.id)} {if $featuredImage} -