| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined('ABSPATH')) exit; // if direct access |
| 4 |
|
| 5 |
function team_body_flat($post_id) |
| 6 |
{ |
| 7 |
|
| 8 |
$team_bg_img = get_post_meta( $post_id, 'team_bg_img', true ); |
| 9 |
$team_themes = get_post_meta( $post_id, 'team_themes', true ); |
| 10 |
$team_grid_item_align = get_post_meta( $post_id, 'team_grid_item_align', true ); |
| 11 |
$team_item_text_align = get_post_meta( $post_id, 'team_item_text_align', true ); |
| 12 |
|
| 13 |
$team_total_items = get_post_meta( $post_id, 'team_total_items', true ); |
| 14 |
$team_column_number = get_post_meta( $post_id, 'team_column_number', true ); |
| 15 |
|
| 16 |
$team_content_source = get_post_meta( $post_id, 'team_content_source', true ); |
| 17 |
$team_content_year = get_post_meta( $post_id, 'team_content_year', true ); |
| 18 |
$team_content_month = get_post_meta( $post_id, 'team_content_month', true ); |
| 19 |
$team_content_month_year = get_post_meta( $post_id, 'team_content_month_year', true ); |
| 20 |
|
| 21 |
$team_posttype = 'team_member'; |
| 22 |
$team_taxonomy = 'team_group'; |
| 23 |
$team_taxonomy_category = get_post_meta( $post_id, 'team_taxonomy_category', true ); |
| 24 |
|
| 25 |
|
| 26 |
$team_post_ids = get_post_meta( $post_id, 'team_post_ids', true ); |
| 27 |
|
| 28 |
$team_items_title_color = get_post_meta( $post_id, 'team_items_title_color', true ); |
| 29 |
$team_items_title_font_size = get_post_meta( $post_id, 'team_items_title_font_size', true ); |
| 30 |
|
| 31 |
$team_items_position_font_size = get_post_meta( $post_id, 'team_items_position_font_size', true ); |
| 32 |
$team_items_position_color = get_post_meta( $post_id, 'team_items_position_color', true ); |
| 33 |
|
| 34 |
$team_items_content_color = get_post_meta( $post_id, 'team_items_content_color', true ); |
| 35 |
$team_items_content_font_size = get_post_meta( $post_id, 'team_items_content_font_size', true ); |
| 36 |
$team_items_content_height = get_post_meta( $post_id, 'team_items_content_height', true ); |
| 37 |
|
| 38 |
$team_items_thumb_size = get_post_meta( $post_id, 'team_items_thumb_size', true ); |
| 39 |
$team_items_max_width = get_post_meta( $post_id, 'team_items_max_width', true ); |
| 40 |
$team_items_thumb_max_hieght = get_post_meta( $post_id, 'team_items_thumb_max_hieght', true ); |
| 41 |
|
| 42 |
$team_items_margin = get_post_meta( $post_id, 'team_items_margin', true ); |
| 43 |
|
| 44 |
$team_body = ''; |
| 45 |
$team_body = '<style type="text/css"></style>'; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
$team_body .= ' |
| 50 |
<div class="team-container" style="background-image:url('.$team_bg_img.');text-align:'.$team_grid_item_align.';"> |
| 51 |
|
| 52 |
<ul id="team-'.$post_id.'" class="team-items team-flat">'; |
| 53 |
|
| 54 |
global $wp_query; |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
if(($team_content_source=="latest")) |
| 60 |
{ |
| 61 |
|
| 62 |
$wp_query = new WP_Query( |
| 63 |
array ( |
| 64 |
'post_type' => $team_posttype, |
| 65 |
'orderby' => 'date', |
| 66 |
'order' => 'DESC', |
| 67 |
'posts_per_page' => $team_total_items, |
| 68 |
|
| 69 |
) ); |
| 70 |
|
| 71 |
|
| 72 |
} |
| 73 |
|
| 74 |
elseif(($team_content_source=="older")) |
| 75 |
{ |
| 76 |
|
| 77 |
$wp_query = new WP_Query( |
| 78 |
array ( |
| 79 |
'post_type' => $team_posttype, |
| 80 |
'orderby' => 'date', |
| 81 |
'order' => 'ASC', |
| 82 |
'posts_per_page' => $team_total_items, |
| 83 |
|
| 84 |
) ); |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
elseif(($team_content_source=="year")) |
| 89 |
{ |
| 90 |
|
| 91 |
$wp_query = new WP_Query( |
| 92 |
array ( |
| 93 |
'post_type' => $team_posttype, |
| 94 |
'year' => $team_content_year, |
| 95 |
'posts_per_page' => $team_total_items, |
| 96 |
) ); |
| 97 |
|
| 98 |
} |
| 99 |
|
| 100 |
elseif(($team_content_source=="month")) |
| 101 |
{ |
| 102 |
|
| 103 |
$wp_query = new WP_Query( |
| 104 |
array ( |
| 105 |
'post_type' => $team_posttype, |
| 106 |
'year' => $team_content_month_year, |
| 107 |
'monthnum' => $team_content_month, |
| 108 |
'posts_per_page' => $team_total_items, |
| 109 |
|
| 110 |
) ); |
| 111 |
|
| 112 |
} |
| 113 |
|
| 114 |
elseif($team_content_source=="taxonomy") |
| 115 |
{ |
| 116 |
$wp_query = new WP_Query( |
| 117 |
array ( |
| 118 |
'post_type' => $team_posttype, |
| 119 |
'posts_per_page' => $team_total_items, |
| 120 |
|
| 121 |
'tax_query' => array( |
| 122 |
array( |
| 123 |
'taxonomy' => $team_taxonomy, |
| 124 |
'field' => 'id', |
| 125 |
'terms' => $team_taxonomy_category, |
| 126 |
) |
| 127 |
) |
| 128 |
|
| 129 |
) ); |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
elseif(($team_content_source=="post_id")) |
| 135 |
{ |
| 136 |
|
| 137 |
$wp_query = new WP_Query( |
| 138 |
array ( |
| 139 |
'post__in' => $team_post_ids, |
| 140 |
'post_type' => $team_posttype, |
| 141 |
|
| 142 |
|
| 143 |
) ); |
| 144 |
|
| 145 |
|
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
if ( $wp_query->have_posts() ) : |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
while ( $wp_query->have_posts() ) : $wp_query->the_post(); |
| 157 |
|
| 158 |
|
| 159 |
$team_thumb = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), $team_items_thumb_size ); |
| 160 |
$team_thumb_url = $team_thumb['0']; |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
$team_body.= '<li style="width:'.$team_items_max_width.';text-align:'.$team_item_text_align.';margin:20px '.$team_items_margin.'" class="team-item" >'; |
| 168 |
$team_body.= '<div class="team-post">'; |
| 169 |
|
| 170 |
if(!empty($team_thumb_url)) |
| 171 |
{ |
| 172 |
$team_body.= ' |
| 173 |
<div style="height:'.$team_items_thumb_max_hieght.';" class="team-thumb"> |
| 174 |
<img src="'.$team_thumb_url.'" /> |
| 175 |
|
| 176 |
</div>'; |
| 177 |
} |
| 178 |
|
| 179 |
|
| 180 |
$team_member_position = get_post_meta(get_the_ID(), 'team_member_position', true ); |
| 181 |
$team_member_website = get_post_meta( get_the_ID(), 'team_member_website', true ); |
| 182 |
$team_member_email = get_post_meta( get_the_ID(), 'team_member_email', true ); |
| 183 |
$team_member_skype = get_post_meta( get_the_ID(), 'team_member_skype', true ); |
| 184 |
$team_member_social_links = get_post_meta( get_the_ID(), 'team_member_social_links', true ); |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
$team_body.= ' |
| 191 |
<div class="team-title" style="color:'.$team_items_title_color.';font-size:'.$team_items_title_font_size.'">'.get_the_title().' |
| 192 |
</div>'; |
| 193 |
if(!empty($team_member_position)) |
| 194 |
{ |
| 195 |
$team_body.= '<div class="team-position" style="color:'.$team_items_position_color.';font-size:'.$team_items_position_font_size.'">'.$team_member_position.' |
| 196 |
</div>'; |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
$team_body.= '<div class="team-social" >'; |
| 201 |
|
| 202 |
|
| 203 |
$team_member_social_field = get_option( 'team_member_social_field' ); |
| 204 |
|
| 205 |
if(empty($team_member_social_field)) |
| 206 |
{ |
| 207 |
$team_member_social_field = array("facebook"=>"facebook","twitter"=>"twitter","googleplus"=>"googleplus","pinterest"=>"pinterest"); |
| 208 |
|
| 209 |
} |
| 210 |
|
| 211 |
|
| 212 |
foreach ($team_member_social_field as $value) { |
| 213 |
if(!empty($value) && !empty($team_member_social_links[$value])) |
| 214 |
{ |
| 215 |
|
| 216 |
$team_body.= '<span class="'.$value.'"> |
| 217 |
<a target="_blank" href="'.$team_member_social_links[$value].'"> </a> |
| 218 |
</span>'; |
| 219 |
|
| 220 |
} |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
if(!empty($team_member_website)) |
| 228 |
{ |
| 229 |
$team_body.= '<span class="website"> |
| 230 |
<a target="_blank" href="'.$team_member_website .'"></a> |
| 231 |
</span>'; |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
if(!empty($team_member_email)) |
| 236 |
{ |
| 237 |
$team_body.= '<span class="email"> |
| 238 |
<a target="_blank" href="mailto:'.$team_member_email .'"></a> |
| 239 |
</span>'; |
| 240 |
} |
| 241 |
|
| 242 |
if(!empty($team_member_skype)) |
| 243 |
{ |
| 244 |
$team_body.= '<span class="skype"> |
| 245 |
<a title="'.$team_member_skype.'" target="_blank" href="skype:'.$team_member_skype.'"></a> |
| 246 |
</span>'; |
| 247 |
} |
| 248 |
|
| 249 |
$team_body.= '</div>'; |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
$team_body.= '<div class="team-content" style="color:'.$team_items_content_color.';font-size:'.$team_items_content_font_size.';height:'.$team_items_content_height.';">'.get_the_content().' |
| 254 |
</div> |
| 255 |
|
| 256 |
</div> |
| 257 |
|
| 258 |
</li>'; |
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
endwhile; |
| 264 |
|
| 265 |
wp_reset_query(); |
| 266 |
endif; |
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
$team_body .= '</ul></div>'; |
| 271 |
|
| 272 |
$team_body .= '<script type="text/javascript"> |
| 273 |
jQuery(function($) { |
| 274 |
$(".team-content").dotdotdot(); |
| 275 |
|
| 276 |
}); |
| 277 |
</script>'; |
| 278 |
|
| 279 |
|
| 280 |
return $team_body; |
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
} |