| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/successkpi/wp-content/themes/successkpi/blocks/leadership-team/ |
Upload File : |
<?php
if (function_exists('render_block_preview_image') && render_block_preview_image($block, 'Team Gallery of succeskpi')) {
return;
}
$display_mode = get_field('automatically_or_manually') ?: 'automatic';
$heading_leadership = get_field('heading_for_leadership');
$heading_advisory = get_field('heading_for_advisory');
$render_team_card = function ($post_id) {
$title = get_the_title($post_id);
$linked_in_url = get_field('linked_in_url', $post_id);
$position = get_field('position', $post_id);
$image_url = get_the_post_thumbnail_url($post_id, 'medium');
$href_link = (isset($linked_in_url) && !empty($linked_in_url)) ? esc_url($linked_in_url) : '#';
?>
<div class="team-member">
<a href="<?php echo $href_link; ?>" class="content click" target="_blank" rel="noopener noreferrer">
<div class="member-image">
<?php if (isset($image_url) && !empty($image_url)) : ?>
<img src="<?php echo esc_url($image_url); ?>" class="attachment-medium size-medium wp-post-image" alt="<?php echo esc_attr($title); ?>" />
<?php endif; ?>
</div>
<div class="team-disc">
<div class="team-disc-heading">
<span><?php echo esc_html($title); ?></span>
<img decoding="async" src="/wp-content/uploads/2026/06/leader-linkedin-icon.svg" alt="linkedin" class="entered lazyloaded">
</div>
<div class="designation">
<?php if (isset($position) && !empty($position)) echo esc_html($position); ?>
</div>
</div>
</a>
</div>
<?php
};
$groups = array(
'our-leadership-team' => array(
'heading' => $heading_leadership,
'posts' => array(),
),
'our-advisory-board' => array(
'heading' => $heading_advisory,
'posts' => array(),
),
);
if ($display_mode === 'manual') {
$selected_teams = get_field('teams');
if ($selected_teams) {
foreach ($selected_teams as $team_member) {
$post_id = $team_member->ID;
$terms = get_the_terms($post_id, 'user_type');
if ($terms && !is_wp_error($terms)) {
foreach ($terms as $term) {
if (isset($groups[$term->slug])) {
$groups[$term->slug]['posts'][] = $post_id;
}
}
}
}
}
} else {
$user_type_data = get_field('user_type');
$query_options = get_field('query_options');
$num_posts = (isset($query_options['number_of_posts']) && !empty($query_options['number_of_posts'])) ? $query_options['number_of_posts'] : -1;
$order = (isset($query_options['order']) && $query_options['order'] == 'Oldest') ? 'ASC' : 'DESC';
$allowed_slugs = array();
if (!empty($user_type_data)) {
if (!is_array($user_type_data)) {
$user_type_data = array($user_type_data);
}
foreach ($user_type_data as $item) {
if (is_object($item) && isset($item->slug)) {
$allowed_slugs[] = $item->slug;
} elseif (is_numeric($item)) {
$t = get_term($item, 'user_type');
if ($t && !is_wp_error($t)) {
$allowed_slugs[] = $t->slug;
}
}
}
} else {
$allowed_slugs = array('our-leadership-team', 'our-advisory-board');
}
foreach ($groups as $slug => $group_data) {
if (in_array($slug, $allowed_slugs)) {
$args = array(
'post_type' => 'teams',
'posts_per_page' => $num_posts,
'orderby' => 'date',
'order' => $order,
'tax_query' => array(
array(
'taxonomy' => 'user_type',
'field' => 'slug',
'terms' => $slug,
),
),
);
$team_query = new WP_Query($args);
if ($team_query->have_posts()) {
while ($team_query->have_posts()) {
$team_query->the_post();
$groups[$slug]['posts'][] = get_the_ID();
}
wp_reset_postdata();
}
}
}
}
?>
<section class="leadership-team-section sk-section-spacing">
<div class="container">
<?php
foreach ($groups as $slug => $group_data) {
if (!empty($group_data['posts'])) {
echo '<div class="team-group">';
if (!empty($group_data['heading'])) {
echo '<h2>' . wp_strip_all_tags($group_data['heading']) . '</h2>';
}
echo '<div class="team-members-cards" data-aos="fade-up">';
foreach ($group_data['posts'] as $post_id) {
$render_team_card($post_id);
}
echo '</div>';
echo '</div>';
}
}
?>
</div>
</section>