<?php
get_header();
while(have_posts()):the_post();
$id=get_the_ID();
$sections=array_filter(array_map('sanitize_key',explode(',',lt_theme_option('profile_order'))));
$disabled=array_filter(array_map('sanitize_key',explode(',',lt_theme_option('profile_disabled'))));
$layout=sanitize_html_class(lt_theme_option('profile_layout','split'));
$show_photo=(bool)lt_theme_option('profile_show_photo');
$email=get_post_meta($id,'lt_email',true);$phone=get_post_meta($id,'lt_phone',true);$linkedin=get_post_meta($id,'lt_linkedin',true);
?>
<main id="main-content" class="lt-profile-page lt-profile-page--<?php echo esc_attr($layout); ?> <?php echo esc_attr(lt_theme_content_width_class('profile')); ?>">
<section class="lt-page-hero"><div class="lt-container lt-page-hero__grid"><div><?php lt_theme_breadcrumbs(); ?><div class="lt-kicker"><?php echo esc_html(get_post_meta($id,'lt_role',true)); ?></div><h1><?php the_title(); ?></h1><?php if(get_post_meta($id,'lt_short_bio',true)): ?><p class="lt-lead"><?php echo esc_html(get_post_meta($id,'lt_short_bio',true)); ?></p><?php endif; ?><div class="lt-hero-actions"><?php if($email): ?><a class="lt-button lt-button--outline" href="mailto:<?php echo esc_attr(antispambot($email)); ?>"><?php esc_html_e('Email','law-temple-theme'); ?></a><?php endif; ?><a class="lt-button lt-button--text" href="<?php echo esc_url(add_query_arg('lt_vcard',$id,home_url('/'))); ?>"><?php esc_html_e('Download vCard','law-temple-theme'); ?></a></div></div><?php if($show_photo&&has_post_thumbnail()): ?><div class="lt-page-hero__image"><?php the_post_thumbnail('lt-portrait',array('loading'=>'eager','fetchpriority'=>'high')); ?></div><?php endif; ?></div></section>
<div class="lt-container lt-profile-shell">
<div class="lt-profile-main">
<nav class="lt-profile-nav" aria-label="<?php esc_attr_e('Profile sections','law-temple-theme'); ?>"><?php foreach($sections as $s)if(!in_array($s,$disabled,true)&&lt_theme_profile_section_has_content($s,$id))echo '<a href="#profile-'.esc_attr($s).'">'.esc_html(ucwords(str_replace('-',' ',$s))).'</a>'; ?></nav>
<?php foreach($sections as $section){if(in_array($section,$disabled,true)||!lt_theme_profile_section_has_content($section,$id))continue;$file=LT_THEME_DIR.'template-parts/profile/'.$section.'.php';if(file_exists($file))get_template_part('template-parts/profile/'.$section,null,array('post_id'=>$id));} ?>
</div>
<?php if(lt_theme_option('profile_contact_rail')&&($email||$phone||$linkedin)): ?><aside class="lt-profile-contact-rail"><div class="lt-kicker"><?php esc_html_e('Contact','law-temple-theme'); ?></div><?php if($email): ?><a href="mailto:<?php echo esc_attr(antispambot($email)); ?>"><?php echo esc_html(antispambot($email)); ?></a><?php endif; ?><?php if($phone): ?><a href="tel:<?php echo esc_attr(preg_replace('/[^0-9+]/','',$phone)); ?>"><?php echo esc_html($phone); ?></a><?php endif; ?><?php if($linkedin): ?><a href="<?php echo esc_url($linkedin); ?>" rel="noopener noreferrer"><?php esc_html_e('LinkedIn','law-temple-theme'); ?></a><?php endif; ?></aside><?php endif; ?>
</div></main>
<?php endwhile;get_footer(); ?>
