Page Member

<?php
add_filter(‘the_content’, function($content){
if (!is_singular(‘yekta_member’)) return $content;
$nav = ‘
<nav class=”yekta-nav”>
<a href=”#certificates”>گواهی پایان دوره</a>
<a href=”#resume”>رزومه / بیوگرافی</a>
<a href=”#awards”>لوح تقدیر</a>
<a href=”#ceo-letter”>نامه مدیرعامل</a>
</nav>’;
return $nav . ‘<div class=”yekta-profile”>’ . $content . ‘</div>’;
});

add_action(‘wp_head’, function(){ ?>
<style>
.yekta-nav {
display: flex;
gap: 12px;
flex-wrap: wrap;
margin: 0 0 16px 0;
}
.yekta-nav a {
padding: 10px 18px;
border-radius: 999px;
text-decoration: none;
font-size: 14px;
font-weight: 500;
color: #fff;
background: linear-gradient(135deg, #4f46e5, #9333ea);
box-shadow: 0 2px 6px rgba(0,0,0,0.15);
transition: all .25s ease;
}
.yekta-nav a:hover {
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(0,0,0,0.25);
background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.yekta-profile {margin-top:20px}
.yekta-section {margin-bottom:28px}
.yekta-section h3 {
margin-bottom:12px;
font-size: 18px;
border-bottom: 2px solid #e5e7eb;
padding-bottom: 6px;
color: #4f46e5;
}
</style>
<?php });

add_action(‘wp_footer’, function(){
if (!is_singular(‘yekta_member’)) return;
$post_id = get_queried_object_id();
$letter = get_post_meta($post_id, ‘ceo_letter_html’, true);
?>
<script>
document.addEventListener(‘DOMContentLoaded’, function(){
const map = {
‘رزومه / بیوگرافی’: ‘resume’,
‘گواهی پایان دوره’: ‘certificates’,
‘لوح تقدیر’: ‘awards’
};
document.querySelectorAll(‘.yekta-section h3’).forEach(h=>{
const t = (h.textContent || ”).trim();
if (map[t]) h.id = map[t];
});
var ceoHTML = <?php echo json_encode($letter ?: ”); ?>;
if (ceoHTML) {
const prof = document.querySelector(‘.yekta-profile’);
if (!prof) return;
const sec = document.createElement(‘div’);
sec.className = ‘yekta-section’;
const h3 = document.createElement(‘h3’);
h3.textContent = ‘نامه مدیرعامل’;
h3.id = ‘ceo-letter’;
const box = document.createElement(‘div’);
box.className = ‘yekta-resume’;
box.innerHTML = ceoHTML;
sec.appendChild(h3);
sec.appendChild(box);
prof.appendChild(sec);
}
});
</script>
<?php
}, 50);