feat(core): integrasi navigasi hamburger mobile, single-program template, floating whatsapp, dan back-to-top

This commit is contained in:
Mas Budi Kusuma
2026-09-15 23:08:59 +07:00
parent 77819e7d1f
commit 9786cd515a
4 changed files with 224 additions and 41 deletions
+50 -4
View File
@@ -6,13 +6,18 @@ $footer_logo = get_option( 'edukarsa_footer_logo' );
if ( empty( $footer_logo ) ) {
$footer_logo = get_option( 'edukarsa_header_logo' );
}
$raw_telp = get_option( 'edukarsa_footer_telp', '' );
$wa_clean = preg_replace( '/[^0-9]/', '', $raw_telp );
if ( substr( $wa_clean, 0, 1 ) === '0' ) {
$wa_clean = '62' . substr( $wa_clean, 1 );
}
?>
<!-- MAIN FOOTER -->
<footer class="site-footer">
<div class="container footer-grid-wrapper">
<!-- Kolom 1: Identitas & Visi Kampus -->
<!-- Kolom 1: Brand & Profil -->
<div class="footer-col footer-col-brand">
<div class="footer-brand-logo">
<?php if ( ! empty( $footer_logo ) ) : ?>
@@ -48,7 +53,7 @@ if ( empty( $footer_logo ) ) {
</li>
<li>
<span class="f-icon">📞</span>
<a href="tel:<?php echo esc_attr( preg_replace( '/[^0-9+]/', '', get_option( 'edukarsa_footer_telp', '' ) ) ); ?>">
<a href="tel:<?php echo esc_attr( $wa_clean ); ?>">
<?php echo esc_html( get_option( 'edukarsa_footer_telp', '(021) 000-0000' ) ); ?>
</a>
</li>
@@ -92,7 +97,7 @@ if ( empty( $footer_logo ) ) {
<?php if ( get_option( 'edukarsa_tampil_ig', 1 ) == 1 && get_option( 'edukarsa_footer_ig' ) ) : ?>
<a href="<?php echo esc_url( get_option( 'edukarsa_footer_ig' ) ); ?>" target="_blank" rel="noopener" class="social-btn" title="Instagram">
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/></svg>
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689-.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/></svg>
</a>
<?php endif; ?>
@@ -118,7 +123,7 @@ if ( empty( $footer_logo ) ) {
</div>
<!-- COPYRIGHT BOTTOM BAR -->
<!-- COPYRIGHT BAR -->
<div class="footer-bottom-bar">
<div class="container footer-bottom-inner">
<p class="copyright-text">
@@ -131,6 +136,47 @@ if ( empty( $footer_logo ) ) {
</div>
</footer>
<!-- FLOATING WHATSAPP HOTLINE PPDB -->
<?php if ( ! empty( $wa_clean ) ) : ?>
<a href="https://wa.me/<?php echo esc_attr( $wa_clean ); ?>?text=Halo%20Admin%20EduKarsa,%20saya%20ingin%20bertanya%20mengenai%20pendaftaran." target="_blank" rel="noopener" class="edukarsa-wa-float" title="Chat WhatsApp Panitia PMB">
<svg width="24" height="24" viewBox="0 0 24 24" fill="#ffffff"><path d="M12.031 6.172c-3.181 0-5.767 2.586-5.768 5.766-.001 1.298.38 2.27 1.019 3.287l-.711 2.598 2.664-.699c.971.53 1.777.82 2.796.82h.005c3.18 0 5.767-2.586 5.768-5.766 0-3.18-2.587-5.806-5.773-5.806zm3.376 8.214c-.149.42-.767.781-1.072.829-.304.048-.687.069-2.203-.559-1.933-.801-3.178-2.775-3.275-2.905-.095-.129-.778-1.036-.778-1.975 0-.94.492-1.401.667-1.593.175-.192.383-.24.512-.24.129 0 .258.006.371.012.12.006.279-.045.436.334.164.397.558 1.365.607 1.465.049.099.082.217.017.348-.065.131-.098.212-.195.328-.098.115-.205.258-.293.346-.098.098-.201.205-.087.401.115.196.512.846 1.099 1.368.756.673 1.393.882 1.59.98.196.098.312.082.426-.049.115-.131.492-.573.623-.77.131-.196.262-.164.442-.098.18.065 1.147.541 1.344.639.196.098.328.147.377.229.049.082.049.475-.1.895z"/></svg>
<span>Tanya PMB</span>
</a>
<?php endif; ?>
<!-- TOMBOL BACK TO TOP -->
<button id="back-to-top" class="back-to-top-btn" aria-label="Kembali ke atas">▲</button>
<!-- NATIVE VANILLA SCRIPT: HAMBURGER & BACK-TO-TOP -->
<script>
document.addEventListener("DOMContentLoaded", function() {
// 1. Toggle Mobile Menu Drawer
const toggleBtn = document.getElementById("mobile-menu-toggle");
const navMenu = document.getElementById("site-navigation");
if (toggleBtn && navMenu) {
toggleBtn.addEventListener("click", function() {
toggleBtn.classList.toggle("active");
navMenu.classList.toggle("active");
});
}
// 2. Back to Top Smooth Logic
const bttBtn = document.getElementById("back-to-top");
if (bttBtn) {
window.addEventListener("scroll", function() {
if (window.scrollY > 350) {
bttBtn.classList.add("show");
} else {
bttBtn.classList.remove("show");
}
});
bttBtn.addEventListener("click", function() {
window.scrollTo({ top: 0, behavior: "smooth" });
});
}
});
</script>
<?php wp_footer(); ?>
</body>
</html>
+45 -37
View File
@@ -1,37 +1,45 @@
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header class="site-header bg-dark-blue">
<div class="container header-container">
<div class="site-branding">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="logo-link">
<?php
$header_logo = get_option('edukarsa_header_logo');
if ( !empty($header_logo) ) :
?>
<img src="<?php echo esc_url($header_logo); ?>" alt="<?php bloginfo( 'name' ); ?>" style="max-height: 55px; object-fit: contain;">
<?php else : ?>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<?php endif; ?>
</a>
</div>
<nav class="main-navigation">
<?php
wp_nav_menu( array(
'theme_location' => 'menu-utama',
'menu_id' => 'primary-menu',
'fallback_cb' => false,
'container' => false,
'menu_class' => 'nav-menu-custom'
) );
?>
</nav>
</div>
</header>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header class="site-header">
<div class="container header-container">
<div class="site-branding">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="logo-link">
<?php
$header_logo = get_option('edukarsa_header_logo');
if ( ! empty( $header_logo ) ) :
?>
<img src="<?php echo esc_url( $header_logo ); ?>" alt="<?php bloginfo( 'name' ); ?>" style="max-height: 52px; object-fit: contain;">
<?php else : ?>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<?php endif; ?>
</a>
</div>
<!-- Tombol Hamburger Mobile -->
<button class="menu-toggle" id="mobile-menu-toggle" aria-label="Buka Menu Navigasi">
<span></span>
<span></span>
<span></span>
</button>
<!-- Navigasi Utama -->
<nav class="main-navigation" id="site-navigation">
<?php
wp_nav_menu( array(
'theme_location' => 'menu-utama',
'menu_id' => 'primary-menu',
'fallback_cb' => false,
'container' => false,
'menu_class' => 'nav-menu-custom'
) );
?>
</nav>
</div>
</header>
+51
View File
@@ -0,0 +1,51 @@
<?php
/**
* Template untuk Detail Program Akademik / Unggulan
*/
get_header();
?>
<main id="primary" class="site-main" style="padding: 50px 0; background-color: #f8fafc; min-height: 75vh;">
<div class="container single-layout-wrapper">
<!-- Detail Konten Program -->
<article id="post-<?php the_ID(); ?>" <?php post_class( 'card-style' ); ?> style="padding: 40px;">
<?php while ( have_posts() ) : the_post(); ?>
<header class="entry-header" style="margin-bottom: 25px; border-bottom: 1px solid #e2e8f0; padding-bottom: 15px;">
<span class="badge-title">PROGRAM STUDI & KEUNGGULAN</span>
<h1 class="entry-title" style="color: var(--heading-color); margin-top: 5px; font-size: 30px;">
<?php the_title(); ?>
</h1>
</header>
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail" style="margin-bottom: 30px; border-radius: var(--radius); overflow: hidden;">
<?php the_post_thumbnail( 'full', array( 'style' => 'width: 100%; height: auto; display: block;' ) ); ?>
</div>
<?php endif; ?>
<div class="entry-content">
<?php the_content(); ?>
</div>
<div class="card-style" style="margin-top: 40px; padding: 25px; background: #f1f5f9; border-left: 5px solid var(--secondary-color);">
<h3 style="margin-bottom: 8px; font-size: 18px; color: var(--heading-color);">Tertarik dengan program ini?</h3>
<p style="font-size: 14px; color: var(--text-muted); margin-bottom: 18px;">
Dapatkan informasi lengkap mengenai syarat pendaftaran, kurikulum terpadu, dan beasiswa pendidikan yang tersedia.
</p>
<a href="<?php echo esc_url( get_option( 'edukarsa_cta_btn_url', '#footer' ) ); ?>" class="btn-primary">
Konsultasi Program &raquo;
</a>
</div>
<?php endwhile; ?>
</article>
<!-- Sidebar Widget -->
<?php get_sidebar(); ?>
</div>
</main>
<?php
get_footer();
?>
+78
View File
@@ -285,3 +285,81 @@ h1, h2, h3, h4, h5, h6 { color: var(--heading-color); font-weight: 800; line-hei
.cta-floating-card { padding: 25px; }
.cta-floating-title { font-size: 20px; }
}
/* 13. MOBILE MENU TOGGLE & DRAWER */
.menu-toggle { display: none; background: transparent; border: none; cursor: pointer; padding: 10px; flex-direction: column; gap: 5px; z-index: 1001; }
.menu-toggle span { display: block; width: 26px; height: 3px; background-color: #ffffff; border-radius: 3px; transition: all 0.3s ease; }
.menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
@media (max-width: 768px) {
.menu-toggle { display: flex; }
.main-navigation {
position: fixed;
top: 0;
right: -100%;
width: 280px;
height: 100vh;
background: var(--primary-color);
box-shadow: -5px 0 25px rgba(0,0,0,0.3);
padding: 85px 25px 40px;
transition: right 0.35s ease-in-out;
z-index: 1000;
overflow-y: auto;
}
.main-navigation.active { right: 0; }
.nav-menu-custom { flex-direction: column; gap: 15px; align-items: flex-start; }
.nav-menu-custom li a { font-size: 15px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.08); width: 100%; }
.header-container { flex-direction: row; }
}
/* 14. FLOATING WHATSAPP HOTLINE */
.edukarsa-wa-float {
position: fixed;
bottom: 25px;
right: 25px;
background-color: #25d366;
color: #ffffff !important;
padding: 10px 18px;
border-radius: 50px;
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 700;
box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
z-index: 998;
transition: all 0.3s ease;
}
.edukarsa-wa-float:hover {
background-color: #1ebc57;
transform: translateY(-3px) scale(1.03);
box-shadow: 0 12px 28px rgba(37, 211, 102, 0.5);
}
/* 15. BACK TO TOP BUTTON */
.back-to-top-btn {
position: fixed;
bottom: 25px;
left: 25px;
width: 44px;
height: 44px;
background-color: var(--primary-color);
color: #ffffff;
border: 2px solid rgba(255,255,255,0.2);
border-radius: 50%;
font-size: 14px;
cursor: pointer;
box-shadow: var(--shadow);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transform: translateY(15px);
transition: all 0.3s ease;
z-index: 997;
}
.back-to-top-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top-btn:hover { background-color: var(--secondary-color); transform: translateY(-3px); }