Initial WordPress theme

This commit is contained in:
2026-06-25 15:57:22 +08:00
commit 043faa8b98
19 changed files with 1161 additions and 0 deletions

16
.gitignore vendored Normal file
View File

@@ -0,0 +1,16 @@
.DS_Store
Thumbs.db
.idea/
.vscode/
*.swp
*.swo
node_modules/
vendor/
*.log
*.tmp
wp-content/uploads/
wp-content/cache/

99
archive.php Normal file
View File

@@ -0,0 +1,99 @@
<?php get_header();
$title = '知识库';
$desc = '天津专升本百科全书';
$active_cat = is_category() ? get_queried_object_id() : 0;
$active_tag = is_tag() ? get_queried_object_id() : 0;
$categories = array_filter(array_map('get_category_by_slug', array('exam-policy', 'school-intro', 'major-guide', 'study-method', 'experience')));
$tag_terms = get_terms(array(
'taxonomy' => 'post_tag',
'hide_empty' => true,
'orderby' => 'count',
'order' => 'DESC',
'number' => 8,
));
if (is_category()) {
$term = get_queried_object();
$title = $term->name;
$desc = term_description($term);
} elseif (is_tag()) {
$term = get_queried_object();
$title = '#' . $term->name;
$desc = term_description($term);
} elseif (is_search()) {
$title = sprintf(__('搜索结果: %s', 'gongxue'), get_search_query());
}
?>
<div class="pt-24 min-h-screen bg-apple-grey animate-fade-in">
<div class="max-w-5xl mx-auto px-4 md:px-6 pb-20">
<div class="flex items-center gap-4 mb-10">
<div class="p-3 bg-apple-blue rounded-xl text-white">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 19V5"/><path d="M9 19V5"/><path d="M14 19V5"/><path d="M19 19V5"/></svg>
</div>
<div class="flex-1 min-w-0">
<h1 class="text-3xl font-bold text-apple-dark"><?php echo esc_html($title); ?></h1>
<p class="text-apple-text-gray"><?php echo wp_kses_post($desc); ?></p>
</div>
<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>" class="hidden md:flex relative w-64">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#9CA3AF" stroke-width="2" class="absolute left-3 top-1/2 -translate-y-1/2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
<input type="search" name="s" value="<?php echo esc_attr(get_search_query()); ?>" placeholder="搜索文章..." class="w-full pl-9 pr-4 py-2 bg-white border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-apple-blue/20 focus:border-apple-blue">
</form>
</div>
<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>" class="md:hidden relative mb-6">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#9CA3AF" stroke-width="2" class="absolute left-3 top-1/2 -translate-y-1/2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
<input type="search" name="s" value="<?php echo esc_attr(get_search_query()); ?>" placeholder="搜索文章..." class="w-full pl-9 pr-4 py-2.5 bg-white border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-apple-blue/20 focus:border-apple-blue">
</form>
<div class="flex flex-wrap gap-2 mb-8">
<a href="<?php echo esc_url(gx_knowledge_url()); ?>" class="px-4 py-2 rounded-full <?php echo (!is_category() && !is_tag() && !is_search()) ? 'bg-apple-blue text-white' : 'bg-white text-gray-500 hover:text-apple-blue'; ?>">全部</a>
<?php foreach ($categories as $cat): ?>
<a href="<?php echo esc_url(get_category_link($cat->term_id)); ?>" class="px-4 py-2 rounded-full <?php echo $active_cat === $cat->term_id ? 'bg-apple-blue text-white' : 'bg-white text-gray-500 hover:text-apple-blue'; ?>"><?php echo esc_html($cat->name); ?></a>
<?php endforeach; ?>
</div>
<?php if (!empty($tag_terms) && !is_tag()): ?>
<div class="flex flex-wrap gap-2 mb-8">
<?php foreach ($tag_terms as $tag): ?>
<a href="<?php echo esc_url(get_tag_link($tag)); ?>" class="px-3 py-1 rounded-full bg-white text-xs text-gray-500 hover:text-apple-blue">#<?php echo esc_html($tag->name); ?></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<aside class="space-y-2">
<a href="<?php echo esc_url(gx_knowledge_url()); ?>" class="block p-4 rounded-xl <?php echo (!is_category() && !is_tag() && !is_search()) ? 'bg-white shadow-sm font-semibold text-apple-blue' : 'text-gray-500 hover:bg-white'; ?>">全部</a>
<?php foreach ($categories as $cat): ?>
<a href="<?php echo esc_url(get_category_link($cat->term_id)); ?>" class="block p-4 rounded-xl <?php echo $active_cat === $cat->term_id ? 'bg-white shadow-sm font-semibold text-apple-blue' : 'text-gray-500 hover:bg-white'; ?>"><?php echo esc_html($cat->name); ?></a>
<?php endforeach; ?>
</aside>
<div class="md:col-span-2 space-y-4">
<?php if (have_posts()): while (have_posts()): the_post(); $cats2 = get_the_category(); $cat_name = !empty($cats2) ? $cats2[0]->name : '文章'; $tags = get_the_tags(); ?>
<article class="bg-white p-4 md:p-6 rounded-xl md:rounded-2xl shadow-sm hover:shadow-md transition-all group">
<div class="flex gap-4">
<?php if (has_post_thumbnail()): ?><div class="hidden sm:block w-28 h-20 rounded-lg overflow-hidden flex-shrink-0"><?php the_post_thumbnail('medium', array('class' => 'w-full h-full object-cover','loading'=>'lazy')); ?></div><?php endif; ?>
<div class="flex-1 min-w-0">
<h3 class="font-bold text-base md:text-lg text-apple-dark group-hover:text-apple-blue line-clamp-2">
<?php if (is_sticky(get_the_ID())): ?><span class="inline-block bg-orange-100 text-orange-600 text-[10px] px-1.5 py-0.5 rounded mr-2 align-middle">置顶</span><?php endif; ?>
<a href="<?php the_permalink(); ?>" class="hover:text-apple-blue"><?php the_title(); ?></a>
</h3>
<p class="text-sm text-gray-500 line-clamp-2 hidden md:block mt-2"><?php echo esc_html(wp_trim_words(get_the_excerpt(), 34)); ?></p>
<div class="flex flex-wrap items-center gap-2 mt-3 text-xs text-gray-400">
<span><?php echo esc_html($cat_name); ?></span>
<span><?php echo esc_html(gx_format_views(gx_get_views())); ?> 阅读</span>
<span class="hidden sm:inline"><?php echo esc_html(get_the_date('Y年n月j日')); ?></span>
<span class="flex flex-wrap gap-2">
<?php if ($tags): foreach (array_slice($tags, 0, 3) as $tag): ?><a href="<?php echo esc_url(get_tag_link($tag)); ?>" class="text-gray-400 hover:text-apple-blue">#<?php echo esc_html($tag->name); ?></a><?php endforeach; endif; ?>
</span>
</div>
</div>
</div>
</article>
<?php endwhile; gx_pagination(); else: ?>
<div class="flex flex-col items-center justify-center py-20 text-gray-400">暂无内容</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>

24
assets/css/main.css Normal file
View File

@@ -0,0 +1,24 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{font-family:"SF Pro Display","SF Pro Text","Inter","Noto Sans SC",system-ui,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:#fff;color:#1D1D1F;line-height:1.5}
button,a,[role="button"]{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#d1d1d6;border-radius:4px}
.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.line-clamp-3{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.prose{max-width:none}.prose h2{font-size:1.25rem;margin-top:2rem;margin-bottom:1rem;padding-bottom:.5rem;border-bottom:1px solid #f3f4f6}.prose h3{font-size:1.125rem;margin-top:1.5rem;margin-bottom:.75rem}.prose p{color:#4b5563;line-height:1.75;margin-bottom:1rem}.prose img{border-radius:.75rem;box-shadow:0 1px 2px rgba(0,0,0,.04)}
.gongxue-header.scrolled{background:rgba(255,255,255,.8);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);box-shadow:0 1px 3px rgba(0,0,0,.05)}
.gongxue-header,.gongxue-header *{-webkit-tap-highlight-color:transparent}
.gongxue-header,.gongxue-header:focus,.gongxue-header:focus-visible,.gongxue-header:focus-within{outline:0!important}
.gongxue-header a,.gongxue-header button{outline:none!important;box-shadow:none!important}
.gongxue-header a:focus,.gongxue-header a:focus-visible,.gongxue-header a:active,.gongxue-header button:focus,.gongxue-header button:focus-visible,.gongxue-header button:active{outline:0!important;box-shadow:none!important}
.mobile-menu.active{display:block;animation:fadeIn .3s ease-out forwards}
.gx-phone{position:relative;margin:0 auto;width:100%;max-width:280px;z-index:10;transition:transform .3s;aspect-ratio:1290/2796}.gx-phone:hover{transform:scale(1.02)}
.gx-phone-frame{position:relative;width:100%;height:100%;background:#000;border-radius:16%/7.38%;box-shadow:0 0 0 1px #444,0 0 0 3px #d1d1d1,0 0 0 4px #999,0 20px 50px -10px rgba(0,0,0,.3);padding:3px;overflow:hidden}
.gx-phone-screen{position:relative;width:100%;height:100%;background:#111;border-radius:calc(16% - 1%)/calc(7.38% - .5%);box-shadow:inset 0 0 20px rgba(255,255,255,.08);overflow:hidden}
.gx-phone-screen img{width:100%;height:100%;object-fit:cover;object-position:top;position:relative;z-index:10}.gx-phone-island{position:absolute;top:3.5%;left:50%;transform:translateX(-50%);width:30%;height:3.5%;background:#000;border-radius:20px;z-index:50}.gx-phone-home{position:absolute;bottom:2%;left:50%;transform:translateX(-50%);width:35%;height:.5%;background:rgba(255,255,255,.8);border-radius:999px;z-index:20}
.gx-book{position:relative}.gx-book::before{content:"";position:absolute;inset:-10%;background:linear-gradient(135deg,rgba(255,237,213,.5),rgba(219,234,254,.45));filter:blur(45px);border-radius:999px}.gx-book img{position:relative;z-index:1;width:100%;height:auto;object-fit:contain;filter:drop-shadow(0 20px 30px rgba(0,0,0,.15));transition:transform .5s}.gx-book-card-image img{transform:scale(.9)}.group:hover .gx-book img{transform:scale(1.05) translateY(-6px)}.group:hover .gx-book-card-image img{transform:scale(.95) translateY(-4px)}
.gx-modal{position:fixed;inset:0;z-index:9999;display:none;align-items:center;justify-content:center;padding:1rem}.gx-modal.active{display:flex}.gx-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.6);backdrop-filter:blur(6px)}.gx-modal-panel{position:relative;background:#fff;border-radius:1.5rem;box-shadow:0 25px 80px rgba(0,0,0,.25);width:100%;max-width:28rem;animation:slideUp .25s ease-out}
.floating-service{position:fixed;right:1.5rem;bottom:1.5rem;z-index:50;display:flex;flex-direction:column;align-items:flex-end}.service-menu{display:flex;flex-direction:column;gap:.75rem;margin-bottom:1rem;transition:all .3s;transform-origin:bottom right}.service-menu.closed{opacity:0;transform:scale(.9) translateY(10px);pointer-events:none}.service-item{display:flex;align-items:center;gap:.75rem;background:rgba(255,255,255,.9);backdrop-filter:blur(16px);border:1px solid rgba(255,255,255,.3);padding:.75rem 1rem;border-radius:1rem;box-shadow:0 10px 25px rgba(0,0,0,.1);transition:all .2s}.service-item:hover{background:#fff;transform:scale(1.05)}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes slideUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 KiB

BIN
assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

153
assets/js/main.js Normal file
View File

@@ -0,0 +1,153 @@
(function() {
'use strict';
function initHeader() {
var header = document.querySelector('.gongxue-header');
if (!header) return;
var update = function() { header.classList.toggle('scrolled', window.scrollY > 20); };
window.addEventListener('scroll', update, { passive: true });
update();
}
function initHeaderFocusGuard() {
var header = document.querySelector('.gongxue-header');
if (!header) return;
var clearFocus = function(target) {
if (target && typeof target.blur === 'function') {
requestAnimationFrame(function() { target.blur(); });
}
};
header.addEventListener('pointerdown', function(e) {
clearFocus(e.target.closest('a,button'));
});
header.addEventListener('click', function(e) {
clearFocus(e.target.closest('a,button'));
});
window.addEventListener('pageshow', function() {
if (header.contains(document.activeElement)) {
clearFocus(document.activeElement);
}
});
}
function initMobileMenu() {
var toggle = document.querySelector('.mobile-menu-toggle');
var menu = document.querySelector('.mobile-menu');
if (!toggle || !menu) return;
toggle.addEventListener('click', function() {
var open = menu.classList.contains('active');
menu.classList.toggle('active');
menu.classList.toggle('hidden');
document.body.style.overflow = open ? '' : 'hidden';
});
menu.querySelectorAll('a').forEach(function(link) {
link.addEventListener('click', function() {
menu.classList.remove('active');
menu.classList.add('hidden');
document.body.style.overflow = '';
});
});
}
function initHeroVideo() {
document.querySelectorAll('[data-gx-video]').forEach(function(box) {
var video = box.querySelector('video');
var play = box.querySelector('[data-gx-play]');
var cover = box.querySelector('[data-gx-cover]');
if (!video || !play) return;
play.addEventListener('click', function() {
if (!video.src && video.dataset.src) video.src = video.dataset.src;
video.controls = true;
video.play();
video.classList.remove('opacity-0');
video.classList.add('opacity-100');
if (cover) cover.classList.add('hidden');
play.classList.add('hidden');
});
});
}
function initModals() {
document.querySelectorAll('[data-gx-modal-open]').forEach(function(button) {
button.addEventListener('click', function() {
var modal = document.querySelector(button.dataset.gxModalOpen);
if (modal) modal.classList.add('active');
});
});
document.querySelectorAll('[data-gx-modal-close], .gx-modal-backdrop').forEach(function(button) {
button.addEventListener('click', function() {
var modal = button.closest('.gx-modal');
if (modal) modal.classList.remove('active');
});
});
}
function initFloatingService() {
var toggle = document.querySelector('.service-toggle');
var menu = document.querySelector('.service-menu');
if (!toggle || !menu) return;
toggle.addEventListener('click', function() {
menu.classList.toggle('closed');
toggle.classList.toggle('rotate-90');
});
document.addEventListener('click', function(e) {
var service = document.querySelector('.floating-service');
if (service && !service.contains(e.target)) {
menu.classList.add('closed');
toggle.classList.remove('rotate-90');
}
});
}
function initShare() {
document.querySelectorAll('.gx-share').forEach(function(button) {
button.addEventListener('click', function() {
var url = button.dataset.url || location.href;
var title = button.dataset.title || document.title;
if (navigator.share) {
navigator.share({ title: title, url: url }).catch(function() {});
} else if (navigator.clipboard) {
navigator.clipboard.writeText(url);
button.textContent = '链接已复制';
setTimeout(function() { button.textContent = '分享文章'; }, 1400);
}
});
});
}
function initCounters() {
var nodes = document.querySelectorAll('[data-count-end]');
if (!nodes.length || !('IntersectionObserver' in window)) return;
var observer = new IntersectionObserver(function(entries) {
entries.forEach(function(entry) {
if (!entry.isIntersecting || entry.target.dataset.done) return;
entry.target.dataset.done = '1';
var el = entry.target;
var end = parseFloat(el.dataset.countEnd) || 0;
var suffix = el.dataset.countSuffix || '';
var start = performance.now();
function frame(now) {
var t = Math.min((now - start) / 1800, 1);
var value = end * (1 - Math.pow(1 - t, 4));
el.textContent = Math.round(value) + suffix;
if (t < 1) requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
});
}, { threshold: 0.4 });
nodes.forEach(function(node) { observer.observe(node); });
}
document.addEventListener('DOMContentLoaded', function() {
initHeader();
initHeaderFocusGuard();
initMobileMenu();
initHeroVideo();
initModals();
initFloatingService();
initShare();
initCounters();
});
})();

55
docker-compose.yml Normal file
View File

@@ -0,0 +1,55 @@
services:
db:
image: mysql:8.0
container_name: gongxue-zero-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
volumes:
- db_data:/var/lib/mysql
ports:
- "3307:3306"
wordpress:
image: wordpress:latest
container_name: gongxue-zero-wp
restart: unless-stopped
depends_on:
- db
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
command:
- bash
- -c
- |
sed -i 's|AllowOverride None|AllowOverride All|g' /etc/apache2/apache2.conf
cat > /var/www/html/.htaccess <<'HTACCESS'
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
HTACCESS
chown www-data:www-data /var/www/html/.htaccess
docker-entrypoint.sh apache2-foreground
volumes:
- wp_data:/var/www/html
- ./:/var/www/html/wp-content/themes/gongxue-from-zero
volumes:
db_data:
wp_data:

64
footer.php Normal file
View File

@@ -0,0 +1,64 @@
<?php if (!defined('ABSPATH')) exit; ?>
</main>
<footer class="bg-apple-grey text-apple-text-gray py-16 border-t border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8 mb-12">
<div>
<h3 class="text-apple-dark font-bold text-lg mb-4">恭学教育</h3>
<p class="text-xs leading-relaxed max-w-xs">致力于为天津专升本学子提供教育资源、刷题系统和出版书籍。</p>
</div>
<div>
<h4 class="text-apple-dark font-semibold text-sm mb-4">探索</h4>
<ul class="space-y-2 text-xs">
<li><a href="<?php echo esc_url(home_url('/question-bank')); ?>" class="hover:text-apple-blue">刷题小程序</a></li>
<li><a href="<?php echo esc_url(home_url('/online-school')); ?>" class="hover:text-apple-blue">在线网校 APP</a></li>
<li><a href="<?php echo esc_url(home_url('/books')); ?>" class="hover:text-apple-blue">商城书籍</a></li>
</ul>
</div>
<div>
<h4 class="text-apple-dark font-semibold text-sm mb-4">服务</h4>
<ul class="space-y-2 text-xs">
<li><a href="<?php echo esc_url(gx_knowledge_url()); ?>" class="hover:text-apple-blue">专升本知识库</a></li>
<li><span class="cursor-pointer">企业合作</span></li>
</ul>
</div>
<div>
<h4 class="text-apple-dark font-semibold text-sm mb-4">联系我们</h4>
<ul class="space-y-2 text-xs">
<li>天津市津南区</li>
<li>Tel: 18322616529</li>
<li>Email: gongxuejiaoyu@sina.cn</li>
</ul>
</div>
</div>
<div class="pt-8 border-t border-gray-300 text-center text-xs">Copyright &copy; <?php echo date('Y'); ?> Gongxue Education Group.</div>
</div>
</footer>
<?php $gx_footer_cfg = gx_asset_config(); ?>
<div class="floating-service">
<div class="service-menu closed">
<button data-gx-modal-open="#gx-chat-modal" class="service-item">
<div class="w-10 h-10 rounded-full bg-blue-50 text-apple-blue flex items-center justify-center">💬</div>
<div class="text-left min-w-[80px]"><div class="text-sm font-bold text-gray-800">在线咨询</div><div class="text-xs text-gray-400">实时答疑</div></div>
</button>
<a href="tel:18322616529" class="service-item">
<div class="w-10 h-10 rounded-full bg-blue-50 text-apple-blue flex items-center justify-center">☎</div>
<div class="text-left min-w-[80px]"><div class="text-sm font-bold text-gray-800">课程报名</div><div class="text-xs text-gray-400">18322616529</div></div>
</a>
<a href="<?php echo esc_url(home_url('/books/')); ?>" class="service-item">
<div class="w-10 h-10 rounded-full bg-blue-50 text-apple-blue flex items-center justify-center">📘</div>
<div class="text-left min-w-[80px]"><div class="text-sm font-bold text-gray-800">书籍购买</div><div class="text-xs text-gray-400">官方商城</div></div>
</a>
<a href="<?php echo esc_url(home_url('/online-school/')); ?>" class="service-item">
<div class="w-10 h-10 rounded-full bg-blue-50 text-apple-blue flex items-center justify-center">👥</div>
<div class="text-left min-w-[80px]"><div class="text-sm font-bold text-gray-800">商务合作</div><div class="text-xs text-gray-400">企业/机构</div></div>
</a>
</div>
<button class="service-toggle bg-apple-blue hover:bg-apple-blue-hover text-white w-16 h-16 rounded-full shadow-2xl flex items-center justify-center" aria-label="联系客服">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="currentColor"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
</button>
</div>
<div id="gx-chat-modal" class="gx-modal"><div class="gx-modal-backdrop"></div><div class="gx-modal-panel max-w-md overflow-hidden"><div class="flex items-center justify-between p-4 bg-gradient-to-r from-apple-blue to-blue-600"><div><h3 class="font-bold text-white">在线客服</h3><p class="text-xs text-white/80">在线</p></div><button data-gx-modal-close class="text-white text-2xl">×</button></div><div class="p-4 bg-gray-50"><div class="flex items-start gap-2 mb-4"><div class="w-8 h-8 bg-apple-blue rounded-full flex items-center justify-center text-white">G</div><div class="bg-white rounded-2xl rounded-tl-none px-4 py-3 shadow-sm max-w-[80%]"><p class="text-sm text-gray-800 leading-relaxed">你好同学,正在接入人工客服,您也可以先扫码添加微信沟通。</p></div></div><div class="ml-10 bg-white rounded-2xl rounded-tl-none p-4 shadow-sm inline-block"><img src="<?php echo esc_url($gx_footer_cfg['customer_service_qrcode']); ?>" alt="客服二维码" class="w-48 h-48 rounded-lg"></div></div><div class="p-4 border-t bg-white rounded-b-3xl"><p class="text-xs text-gray-500 text-center">工作时间:周一至周日 9:00-21:00</p></div></div></div>
<?php wp_footer(); ?>
</body>
</html>

138
front-page.php Normal file
View File

@@ -0,0 +1,138 @@
<?php
get_header();
$cfg = gx_asset_config();
$stats = $cfg['stats'];
$news = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 5, 'ignore_sticky_posts' => false));
?>
<div class="w-full">
<section class="relative min-h-screen flex flex-col pt-36 md:pt-48 pb-12 md:pb-32 bg-apple-grey overflow-hidden">
<div class="absolute top-0 left-0 w-full h-full overflow-hidden z-0 opacity-30 pointer-events-none">
<div class="absolute top-[-10%] right-[-20%] w-[800px] h-[800px] bg-blue-100 rounded-full blur-[120px]"></div>
<div class="absolute bottom-[-10%] left-[-20%] w-[600px] h-[600px] bg-purple-100 rounded-full blur-[100px]"></div>
</div>
<div class="relative z-10 max-w-7xl mx-auto px-4 md:px-6 flex flex-col items-center text-center">
<div class="mb-10 animate-fade-in">
<span class="inline-flex items-center gap-2 px-4 py-2 border border-gray-200/60 rounded-full text-xs md:text-sm font-medium text-gray-500 bg-white/80 backdrop-blur-md shadow-sm tracking-wide">
<span class="w-1.5 h-1.5 rounded-full bg-apple-blue animate-pulse"></span>
恭学教育,天津专升本轻奢品牌
</span>
</div>
<h1 class="text-4xl md:text-6xl lg:text-7xl font-semibold text-apple-dark mb-10 md:mb-14 leading-[1.1] tracking-tight animate-slide-up max-w-5xl mx-auto">
赋能未来,<br class="md:hidden"><span class="text-apple-blue">让升本更简单。</span>
</h1>
<div class="w-full max-w-4xl aspect-video bg-black rounded-[1.5rem] md:rounded-[2rem] shadow-2xl overflow-hidden relative group animate-slide-up mb-12 md:mb-16" data-gx-video>
<video data-src="<?php echo esc_url($cfg['hero_video_url']); ?>" poster="<?php echo esc_url($cfg['hero_video_cover']); ?>" class="w-full h-full object-cover opacity-0 transition-opacity duration-500" preload="none"></video>
<img data-gx-cover src="<?php echo esc_url($cfg['hero_video_cover']); ?>" alt="Brand Video Cover" class="absolute inset-0 w-full h-full object-cover opacity-60 group-hover:opacity-40 transition-opacity duration-500 scale-105 group-hover:scale-100">
<button data-gx-play class="absolute inset-0 flex items-center justify-center cursor-pointer" aria-label="播放视频">
<span class="w-16 h-16 md:w-24 md:h-24 bg-white/20 backdrop-blur-md rounded-full flex items-center justify-center border border-white/30 group-hover:scale-110 transition-transform">
<svg class="text-white fill-white ml-1" width="32" height="32" viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>
</span>
</button>
<div class="absolute bottom-4 left-4 md:bottom-10 md:left-10 text-left pointer-events-none">
<h3 class="text-white font-bold text-lg md:text-2xl">了解恭学教育</h3>
<p class="text-gray-300 text-xs md:text-base">观看 2025 年度品牌宣传片</p>
</div>
</div>
<div class="flex flex-wrap gap-3 md:gap-5 justify-center animate-slide-up">
<a href="<?php echo esc_url(home_url('/online-school/')); ?>" class="px-5 py-2.5 md:px-9 md:py-4 bg-apple-blue hover:bg-apple-blue-hover text-white rounded-full text-sm md:text-lg font-medium transition-all transform hover:scale-105 shadow-lg flex items-center justify-center gap-1.5 md:gap-2">开始学习 <svg class="md:w-5 md:h-5" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="m9 18 6-6-6-6"/></svg></a>
<a href="<?php echo esc_url(home_url('/question-bank/')); ?>" class="px-5 py-2.5 md:px-9 md:py-4 bg-white/90 backdrop-blur-md text-apple-blue border-2 border-apple-blue/30 rounded-full text-sm md:text-lg font-medium hover:bg-apple-blue hover:text-white hover:border-apple-blue transition-all flex items-center justify-center gap-1.5 md:gap-2"><svg class="md:w-5 md:h-5" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5v14c0 1.66 4.03 3 9 3s9-1.34 9-3V5"/><path d="M3 12c0 1.66 4.03 3 9 3s9-1.34 9-3"/></svg>大数据中心</a>
<button data-gx-modal-open="#gx-enroll-modal" class="px-5 py-2.5 md:px-9 md:py-4 bg-white/90 backdrop-blur-md text-apple-blue border-2 border-apple-blue/30 rounded-full text-sm md:text-lg font-medium hover:bg-apple-blue hover:text-white hover:border-apple-blue transition-all flex items-center justify-center gap-1.5 md:gap-2"><svg class="md:w-5 md:h-5" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><line x1="19" y1="8" x2="19" y2="14"/><line x1="22" y1="11" x2="16" y2="11"/></svg>报名上课</button>
</div>
</div>
</section>
<section class="py-12 md:py-32 bg-white">
<div class="max-w-7xl mx-auto px-4 md:px-6">
<div class="mb-14 md:mb-20 text-center md:text-left">
<h2 class="text-3xl md:text-5xl font-semibold text-apple-dark mb-5 tracking-tight">核心产品生态</h2>
<p class="text-lg md:text-xl text-gray-500 max-w-2xl mx-auto md:mx-0 leading-relaxed">科技与教育的完美融合。精心打磨的每一个细节,只为给你最高效的学习体验。</p>
</div>
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6 lg:gap-8">
<a href="<?php echo esc_url(home_url('/question-bank/')); ?>" class="lg:col-span-7 relative group overflow-hidden rounded-[2.5rem] bg-black shadow-2xl transition-transform hover:scale-[1.01] flex flex-col md:flex-row">
<div class="absolute inset-0 bg-gradient-to-br from-[#1c1c1e] to-black"></div>
<div class="relative z-20 flex-1 p-10 md:p-12 flex flex-col justify-center items-start">
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/10 border border-white/5 backdrop-blur-md mb-6"><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" class="text-yellow-400"><path d="m12 2 2.4 6.9 7.3.2-5.8 4.4 2.1 7-6-4.1-6 4.1 2.1-7-5.8-4.4 7.3-.2L12 2z"/></svg><span class="text-xs font-bold text-gray-200 tracking-wide uppercase">AI Algorithm 4.0</span></div>
<h3 class="text-3xl md:text-5xl font-bold text-white mb-6 leading-tight">恭学刷题<br><span class="text-blue-500">智能进化。</span></h3>
<p class="text-gray-400 text-base md:text-lg mb-8 max-w-sm leading-relaxed">不只是刷题。大数据精准诊断,哪里不会练哪里,复习效率提升 300%。</p>
<span class="px-6 py-3 bg-white text-black rounded-full font-bold text-sm">立即体验</span>
</div>
<div class="relative z-10 flex-1 min-h-[300px] flex items-end justify-center md:justify-end md:pr-12 pb-0">
<div class="relative w-[240px] md:w-[260px] translate-y-[15%] group-hover:translate-y-[5%] transition-transform duration-700">
<?php gx_phone_mockup($cfg['question_bank_mockup']); ?>
</div>
</div>
</a>
<div class="lg:col-span-5 flex flex-col gap-6 lg:gap-8">
<a href="<?php echo esc_url(home_url('/online-school/')); ?>" class="flex-1 group overflow-hidden rounded-[2rem] md:rounded-[2.5rem] bg-blue-50/50 border border-blue-100 transition-all hover:shadow-xl p-8 flex flex-col sm:flex-row items-center gap-6">
<div class="flex-1 text-center sm:text-left">
<div class="text-apple-blue font-medium mb-3 text-xs uppercase tracking-widest flex items-center gap-2 justify-center sm:justify-start"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg>Online Class</div>
<h3 class="text-2xl md:text-3xl font-bold text-apple-dark mb-2">恭学网校</h3>
<p class="text-gray-500 text-sm mb-6">线上课 APP 随身学</p>
<span class="text-apple-blue text-sm font-semibold">下载 APP </span>
</div>
<div class="relative w-[140px] flex-shrink-0 -rotate-[5deg] group-hover:rotate-0 transition-transform"><?php gx_phone_mockup($cfg['online_school_mockup']); ?></div>
</a>
<a href="<?php echo esc_url(home_url('/books/')); ?>" class="flex-1 group overflow-hidden rounded-[2rem] md:rounded-[2.5rem] bg-[#F5F5F0] transition-all hover:shadow-xl flex flex-col sm:flex-row items-center justify-between p-8 md:p-10 gap-6">
<div class="relative z-10 w-full sm:w-1/2 text-center sm:text-left">
<div class="text-orange-600 font-medium mb-3 text-xs uppercase tracking-widest flex items-center gap-2 justify-center sm:justify-start"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/></svg>Publishing</div>
<h3 class="text-2xl md:text-3xl font-bold text-apple-dark mb-2">权威教材</h3>
<p class="text-gray-500 text-sm mb-6">年年迭代,紧扣大纲。</p>
<span class="text-apple-dark font-semibold text-sm">浏览书店 →</span>
</div>
<div class="gx-book w-full sm:w-1/2 max-w-[180px]"><img src="<?php echo esc_url($cfg['books'][0]['image']); ?>" alt="天津专升本数学"></div>
</a>
</div>
</div>
</div>
</section>
<section class="py-20 bg-white border-t border-gray-100">
<div class="max-w-7xl mx-auto px-6 grid grid-cols-2 md:grid-cols-4 gap-8">
<div class="text-center p-6"><div data-count-end="<?php echo esc_attr($stats['years']); ?>" data-count-suffix="+" class="text-4xl md:text-5xl font-bold text-apple-dark">0+</div><div class="text-gray-500 text-sm uppercase">年专注专升本</div></div>
<div class="text-center p-6"><div class="text-4xl md:text-5xl font-bold text-apple-dark"><?php echo esc_html($stats['students']); ?></div><div class="text-gray-500 text-sm uppercase">累计服务学员</div></div>
<div class="text-center p-6"><div class="text-4xl md:text-5xl font-bold text-apple-dark"><?php echo esc_html($stats['coverage']); ?></div><div class="text-gray-500 text-sm uppercase">真题覆盖率</div></div>
<div class="text-center p-6"><div data-count-end="<?php echo esc_attr($stats['schools']); ?>" data-count-suffix="所" class="text-4xl md:text-5xl font-bold text-apple-dark">0所</div><div class="text-gray-500 text-sm uppercase">合作院校</div></div>
</div>
</section>
<section class="py-24 bg-apple-grey">
<div class="max-w-7xl mx-auto px-6">
<div class="text-center mb-16"><div class="inline-block px-3 py-1 rounded-full bg-white border border-gray-200 text-xs font-bold text-gray-500 mb-4 uppercase tracking-wider">Corporate Culture</div><h2 class="text-3xl md:text-4xl font-bold text-apple-dark">企业文化</h2></div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<?php foreach (array(array('正直','坚守底线,以德为先'),array('进取','勇于突破,拒绝平庸'),array('协作','开放协同,持续进化'),array('创造','超越创新,探索未来')) as $item): ?>
<div class="bg-white p-8 rounded-3xl shadow-sm hover:shadow-lg transition-all flex flex-col items-center text-center"><div class="w-16 h-16 rounded-2xl bg-gray-50 flex items-center justify-center mb-6 text-apple-blue text-2xl">◆</div><h3 class="text-xl font-bold text-apple-dark mb-2"><?php echo esc_html($item[0]); ?></h3><p class="text-gray-500 text-sm"><?php echo esc_html($item[1]); ?></p></div>
<?php endforeach; ?>
</div>
</div>
</section>
<section class="relative py-10 md:py-16 bg-apple-grey">
<div class="max-w-7xl mx-auto px-4 md:px-6"><div class="relative rounded-3xl overflow-hidden shadow-2xl"><img src="https://images.unsplash.com/photo-1519681393784-d120267933ba?w=1600&q=80" alt="恭学愿景" class="w-full h-[300px] md:h-[450px] object-cover"><div class="absolute inset-0 bg-gradient-to-t from-black/70 via-black/30 to-transparent"></div><div class="absolute inset-0 flex flex-col items-center justify-center text-center px-6"><h2 class="text-white text-3xl md:text-5xl font-bold mb-4">种种用心,只为你能省心</h2><p class="text-gray-200 text-sm md:text-lg max-w-2xl">不懈探索、勇于突破、脚踏实地、求真务实。</p></div></div></div>
</section>
<section class="py-20 md:py-28 bg-[#F5F5F7]">
<div class="max-w-7xl mx-auto px-4 md:px-6"><div class="text-center mb-14"><div class="text-apple-blue font-semibold text-sm tracking-widest uppercase mb-3">Dedicated Member</div><h2 class="text-3xl md:text-4xl font-bold text-apple-dark">核心团队</h2></div><div class="grid grid-cols-2 md:grid-cols-4 gap-4 md:gap-6">
<?php foreach ($cfg['team'] as $member): ?><div class="bg-white rounded-2xl md:rounded-3xl p-6 md:p-8 flex flex-col items-center text-center shadow-sm hover:shadow-xl transition-all group"><div class="w-20 h-20 md:w-28 md:h-28 rounded-full overflow-hidden mb-4 md:mb-6 ring-4 ring-white shadow-lg"><img src="<?php echo esc_url($member['avatar']); ?>" alt="<?php echo esc_attr($member['name']); ?>" class="w-full h-full object-cover" loading="lazy"></div><h3 class="text-base md:text-xl font-bold text-apple-dark mb-1"><?php echo esc_html($member['name']); ?></h3><p class="text-gray-500 text-xs md:text-sm"><?php echo esc_html($member['role']); ?></p></div><?php endforeach; ?>
</div></div>
</section>
<section class="py-20 md:py-28 bg-apple-grey">
<div class="max-w-4xl mx-auto px-4 md:px-6"><div class="flex justify-between items-end mb-10 md:mb-14"><h2 class="text-2xl md:text-3xl font-bold text-apple-dark">行业动态 & 咨询</h2><a href="<?php echo esc_url(gx_knowledge_url()); ?>" class="text-apple-blue font-medium hover:underline">查看更多 </a></div><div class="space-y-4 md:space-y-6">
<?php if ($news->have_posts()): while ($news->have_posts()): $news->the_post(); $cats = get_the_category(); $cat = !empty($cats) ? $cats[0]->name : '文章'; ?>
<a href="<?php the_permalink(); ?>" class="bg-white p-5 md:p-6 rounded-2xl shadow-sm hover:shadow-md transition-shadow flex flex-col md:flex-row gap-4 md:gap-6 items-start md:items-center group"><div class="bg-blue-50 group-hover:bg-apple-blue group-hover:text-white transition-colors text-apple-blue px-4 py-2 rounded-lg font-bold text-center min-w-[80px]"><div class="text-lg md:text-xl"><?php echo esc_html(get_the_date('d')); ?></div><div class="text-xs uppercase"><?php echo esc_html(get_the_date('m')); ?>月</div></div><div class="flex-1"><div class="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"><?php echo esc_html($cat); ?></div><h3 class="text-lg md:text-xl font-bold text-apple-dark mb-2 group-hover:text-apple-blue"><?php the_title(); ?></h3><p class="text-apple-text-gray text-sm line-clamp-2"><?php echo esc_html(wp_trim_words(get_the_excerpt(), 26)); ?></p></div></a>
<?php endwhile; wp_reset_postdata(); endif; ?>
</div></div>
</section>
</div>
<div id="gx-enroll-modal" class="gx-modal">
<div class="gx-modal-backdrop"></div>
<div class="gx-modal-panel p-8 text-center">
<button data-gx-modal-close class="absolute top-4 right-4 p-2 rounded-full hover:bg-gray-100">×</button>
<h3 class="text-2xl font-bold text-gray-900 mb-2">扫码添加客服</h3>
<p class="text-gray-500 mb-6">添加微信客服,获取课程规划</p>
<div class="bg-gray-50 rounded-2xl p-6 inline-block"><img src="<?php echo esc_url($cfg['customer_service_qrcode']); ?>" alt="客服二维码" class="w-64 h-64 rounded-lg"></div>
<p class="text-sm text-gray-400 mt-6">工作时间:周一至周日 9:00-21:00</p>
</div>
</div>
<?php get_footer(); ?>

279
functions.php Normal file
View File

@@ -0,0 +1,279 @@
<?php
if (!defined('ABSPATH')) {
exit;
}
function gx_theme_setup() {
add_theme_support('title-tag');
add_theme_support('post-thumbnails');
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script'));
add_theme_support('custom-logo', array('height' => 80, 'width' => 80, 'flex-height' => true, 'flex-width' => true));
add_theme_support('align-wide');
add_theme_support('responsive-embeds');
register_nav_menus(array(
'primary' => __('主导航菜单', 'gongxue'),
));
}
add_action('after_setup_theme', 'gx_theme_setup');
function gx_enqueue_assets() {
$theme_dir = get_template_directory();
$theme_uri = get_template_directory_uri();
wp_enqueue_script('tailwindcss', 'https://cdn.tailwindcss.com', array(), '3.4', false);
wp_add_inline_script('tailwindcss', 'tailwind.config={theme:{extend:{colors:{"apple-grey":"#F5F5F7","apple-dark":"#1D1D1F","apple-blue":"#0071E3","apple-blue-hover":"#0077ED","apple-text-gray":"#86868B"},animation:{"fade-in":"fadeIn .6s ease-out forwards","slide-up":"slideUp .6s ease-out forwards","slide-down":"slideDown .4s ease-out forwards"},keyframes:{fadeIn:{"0%":{opacity:"0"},"100%":{opacity:"1"}},slideUp:{"0%":{opacity:"0",transform:"translateY(20px)"},"100%":{opacity:"1",transform:"translateY(0)"}},slideDown:{"0%":{opacity:"0",transform:"translateY(-10px)"},"100%":{opacity:"1",transform:"translateY(0)"}}}}}};');
wp_enqueue_style('gx-style', $theme_uri . '/assets/css/main.css', array(), filemtime($theme_dir . '/assets/css/main.css'));
wp_enqueue_style('gx-fonts', 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap', array(), null);
wp_enqueue_script('gx-main', $theme_uri . '/assets/js/main.js', array(), filemtime($theme_dir . '/assets/js/main.js'), true);
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'gx_enqueue_assets');
function gx_knowledge_url() {
$page_id = get_option('page_for_posts');
return $page_id ? get_permalink($page_id) : home_url('/knowledge/');
}
function gx_linked_page_item($page, $fallback_label, $active = false) {
if (!$page || is_wp_error($page)) {
return array(
'label' => $fallback_label,
'url' => home_url('/'),
'active' => $active,
);
}
return array(
'label' => get_the_title($page),
'url' => get_permalink($page),
'active' => $active,
);
}
function gx_primary_nav_items() {
$front_page = get_post((int) get_option('page_on_front'));
$knowledge_page = get_post((int) get_option('page_for_posts'));
$question_bank = get_page_by_path('question-bank', OBJECT, 'page');
$online_school = get_page_by_path('online-school', OBJECT, 'page');
$books_page = get_page_by_path('books', OBJECT, 'page');
return array_filter(array(
gx_linked_page_item($front_page, __('首页', 'gongxue'), is_front_page()),
gx_linked_page_item($question_bank, __('刷题题库', 'gongxue'), is_page('question-bank')),
gx_linked_page_item($online_school, __('在线网校', 'gongxue'), is_page('online-school')),
gx_linked_page_item($books_page, __('出版书籍', 'gongxue'), is_page('books')),
gx_linked_page_item($knowledge_page, __('知识库', 'gongxue'), is_home() || is_archive() || is_single()),
));
}
function gx_format_views($count) {
$count = intval($count);
if ($count >= 10000) return round($count / 10000, 1) . 'w+';
if ($count >= 1000) return round($count / 1000, 1) . 'k';
return (string) $count;
}
function gx_get_views($post_id = null) {
$post_id = $post_id ?: get_the_ID();
return intval(get_post_meta($post_id, '_gx_view_count', true));
}
function gx_inc_views() {
if (is_admin() || wp_doing_ajax() || wp_doing_cron() || is_feed() || !is_singular('post')) {
return;
}
$id = get_queried_object_id();
if (!$id) return;
$count = gx_get_views($id) + 1;
update_post_meta($id, '_gx_view_count', $count);
}
add_action('template_redirect', 'gx_inc_views');
function gx_pagination() {
global $wp_query;
$links = paginate_links(array(
'total' => $wp_query->max_num_pages,
'current' => max(1, get_query_var('paged')),
'type' => 'array',
'prev_text' => '',
'next_text' => '',
));
if (!$links) return;
echo '<div class="flex justify-center mt-12"><nav class="flex items-center gap-2">';
foreach ($links as $link) {
$active = strpos($link, 'current') !== false;
echo '<span class="' . ($active ? 'px-4 py-2 bg-apple-blue text-white rounded-full text-sm' : 'px-4 py-2 text-gray-500 hover:text-apple-dark hover:bg-gray-100 rounded-full text-sm') . '">' . $link . '</span>';
}
echo '</nav></div>';
}
function gx_excerpt_len($len) { return 30; }
add_filter('excerpt_length', 'gx_excerpt_len');
function gx_excerpt_more($more) { return '...'; }
add_filter('excerpt_more', 'gx_excerpt_more');
function gx_register_sidebars() {
register_sidebar(array(
'name' => __('知识库侧边栏', 'gongxue'),
'id' => 'knowledge-sidebar',
'before_widget' => '<div class="bg-white p-6 rounded-2xl shadow-sm mb-4">',
'after_widget' => '</div>',
'before_title' => '<h3 class="text-lg font-bold text-apple-dark mb-4">',
'after_title' => '</h3>',
));
}
add_action('widgets_init', 'gx_register_sidebars');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'rest_output_link_wp_head');
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_shortlink_wp_head');
function gx_allow_svg($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'gx_allow_svg');
function gx_seo_description() {
if (is_singular()) {
$excerpt = trim(wp_strip_all_tags(get_the_excerpt()));
if ($excerpt) {
return $excerpt;
}
$content = wp_strip_all_tags(get_the_content());
return wp_trim_words($content, 28, '');
}
if (is_home()) {
$page_id = get_option('page_for_posts');
if ($page_id) {
$excerpt = trim(wp_strip_all_tags(get_post_field('post_excerpt', $page_id)));
if ($excerpt) return $excerpt;
}
return get_bloginfo('description');
}
if (is_front_page()) {
return '赋能未来,让升本更简单。恭学教育提供天津专升本刷题题库、在线网校、出版书籍与知识库服务。';
}
if (is_category() || is_tag()) {
$term = get_queried_object();
if ($term && !is_wp_error($term) && !empty($term->description)) {
return wp_strip_all_tags($term->description);
}
}
return get_bloginfo('description');
}
function gx_seo_title() {
if (is_front_page()) {
return '恭学教育 - 天津专升本培训领军品牌 | 刷题题库 | 在线网校 | 出版书籍';
}
if (is_home()) {
return '知识库 - 天津专升本百科全书';
}
if (is_category()) {
$term = get_queried_object();
return ($term && !is_wp_error($term)) ? $term->name . ' - 知识库' : '知识库';
}
if (is_tag()) {
$term = get_queried_object();
return ($term && !is_wp_error($term)) ? '#' . $term->name . ' - 知识库' : '知识库';
}
if (is_singular('post')) {
return get_the_title() . ' - 知识库';
}
if (is_page()) {
return get_the_title();
}
return wp_get_document_title();
}
function gx_seo_image() {
if (is_singular() && has_post_thumbnail()) {
$image = get_the_post_thumbnail_url(null, 'full');
if ($image) return $image;
}
$cfg = gx_asset_config();
return $cfg['hero_video_cover'];
}
function gx_output_seo_meta() {
if (is_admin()) return;
$title = gx_seo_title();
$desc = gx_seo_description();
$image = gx_seo_image();
$url = is_singular() ? get_permalink() : (is_home() ? gx_knowledge_url() : (is_front_page() ? home_url('/') : home_url(add_query_arg(array(), $GLOBALS['wp']->request ?? ''))));
echo '<meta name="description" content="' . esc_attr($desc) . '">' . "\n";
echo '<meta name="keywords" content="' . esc_attr(get_bloginfo('name') . ',天津专升本,恭学教育,刷题题库,在线网校,出版书籍,知识库') . '">' . "\n";
echo '<meta property="og:title" content="' . esc_attr($title) . '">' . "\n";
echo '<meta property="og:description" content="' . esc_attr($desc) . '">' . "\n";
echo '<meta property="og:url" content="' . esc_url($url) . '">' . "\n";
echo '<meta property="og:type" content="' . esc_attr(is_singular() ? 'article' : 'website') . '">' . "\n";
echo '<meta property="og:image" content="' . esc_url($image) . '">' . "\n";
echo '<meta name="twitter:card" content="summary_large_image">' . "\n";
echo '<meta name="twitter:title" content="' . esc_attr($title) . '">' . "\n";
echo '<meta name="twitter:description" content="' . esc_attr($desc) . '">' . "\n";
echo '<meta name="twitter:image" content="' . esc_url($image) . '">' . "\n";
echo '<link rel="canonical" href="' . esc_url($url) . '">' . "\n";
if (is_singular('post')) {
$author = get_the_author();
$date = get_the_date('c');
$headline = get_the_title();
$article = array(
'@context' => 'https://schema.org',
'@type' => 'Article',
'headline' => $headline,
'description' => $desc,
'author' => array('@type' => 'Person', 'name' => $author),
'datePublished' => $date,
'dateModified' => get_the_modified_date('c'),
'mainEntityOfPage' => $url,
'image' => array($image),
'publisher' => array('@type' => 'Organization', 'name' => get_bloginfo('name')),
);
echo '<script type="application/ld+json">' . wp_json_encode($article, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . '</script>' . "\n";
}
}
add_action('wp_head', 'gx_output_seo_meta', 1);
function gx_asset_config() {
return array(
'hero_video_url' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E6%81%AD%E5%AD%A6%E6%95%99%E8%82%B2%E5%93%81%E7%89%8C%E5%AE%A3%E4%BC%A0.mp4',
'hero_video_cover' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E5%B0%81%E9%9D%A2.png',
'question_bank_mockup' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/tikudemo-tuya.webp',
'online_school_mockup' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/wangkedemo-tuya.webp',
'customer_service_qrcode' => get_template_directory_uri() . '/assets/images/customer-service-qrcode.jpg',
'stats' => array('years' => 7, 'students' => '21W+', 'coverage' => '100%', 'schools' => 12),
'books' => array(
array('title' => '天津专升本数学自学参考书', 'price' => '128.00', 'old' => '168.00', 'image' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E6%95%B0%E5%AD%A61-tuya.webp', 'tag' => '畅销榜第一'),
array('title' => '天津专升本语文自学参考书', 'price' => '128.00', 'old' => '168.00', 'image' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E8%AF%AD%E6%96%871-tuya.webp', 'tag' => '新书首发'),
array('title' => '天津专升本英语自学参考书', 'price' => '128.00', 'old' => '168.00', 'image' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E8%8B%B1%E8%AF%AD1-tuya.webp', 'tag' => '热销'),
array('title' => '天津专升本计算机自学参考书', 'price' => '128.00', 'old' => '168.00', 'image' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%80%92%E5%BD%B1-tuya.webp', 'tag' => '必刷'),
array('title' => '三年模拟一年升本刷题系列套装', 'price' => '128.00', 'old' => '198.00', 'image' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E4%B8%89%E4%B8%80-tuya.webp', 'tag' => '限时优惠'),
),
'team' => array(
array('name' => '陈奕静老师', 'role' => '七年专业课教龄王牌老师', 'avatar' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E9%99%88%E5%A5%95%E9%9D%99-tuya.webp'),
array('name' => '郭馨老师', 'role' => '七年专业课教龄王牌老师', 'avatar' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E9%83%AD%E9%A6%A8%20%282%29-%E8%AE%A1%E7%AE%97%E6%9C%BA-tuya.webp'),
array('name' => '师哲老师', 'role' => '教学总监', 'avatar' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E5%B8%88%E5%93%B22-tuya.webp'),
array('name' => '王沐妍老师', 'role' => '七年专业课教龄王牌老师', 'avatar' => 'https://fenxiang-1304851894.cos.ap-nanjing.myqcloud.com/%E7%8E%8B%E6%B2%90%E5%A6%8D-tuya.webp'),
),
);
}
function gx_phone_mockup($image, $class = '') {
?>
<div class="gx-phone <?php echo esc_attr($class); ?>">
<div class="gx-phone-frame">
<div class="gx-phone-screen">
<div class="gx-phone-island"></div>
<img src="<?php echo esc_url($image); ?>" alt="App Screen" loading="lazy">
<div class="gx-phone-home"></div>
</div>
</div>
</div>
<?php
}

38
header.php Normal file
View File

@@ -0,0 +1,38 @@
<?php if (!defined('ABSPATH')) exit; ?>
<!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('font-sans antialiased text-apple-dark bg-white min-h-screen flex flex-col'); ?>>
<?php wp_body_open(); ?>
<header class="gongxue-header fixed top-0 left-0 right-0 z-50 transition-all duration-300 bg-transparent" id="site-header">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<a href="<?php echo esc_url(home_url('/')); ?>" class="flex items-center group">
<img src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/logo.png'); ?>" alt="恭学教育Logo" class="w-8 h-8 mr-2" onerror="this.style.display='none';this.nextElementSibling.style.display='flex';">
<div class="w-8 h-8 bg-apple-blue rounded-lg hidden items-center justify-center mr-2 text-white font-bold">G</div>
<span class="font-bold text-lg tracking-tight text-apple-blue">恭学教育</span>
</a>
<nav class="hidden md:flex space-x-8">
<?php foreach (gx_primary_nav_items() as $item): ?>
<a href="<?php echo esc_url($item['url']); ?>" class="text-sm font-medium <?php echo !empty($item['active']) ? 'text-apple-blue' : 'text-apple-text-gray hover:text-apple-dark'; ?>"><?php echo esc_html($item['label']); ?></a>
<?php endforeach; ?>
</nav>
<button class="mobile-menu-toggle md:hidden text-apple-dark p-2" aria-label="切换菜单">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
</div>
</div>
<div class="mobile-menu md:hidden absolute top-16 left-0 right-0 bg-white h-screen border-t border-gray-100 p-4 hidden">
<div class="flex flex-col space-y-6 mt-4">
<?php foreach (gx_primary_nav_items() as $item): ?>
<a href="<?php echo esc_url($item['url']); ?>" class="text-2xl font-semibold py-2 border-b border-gray-100 <?php echo !empty($item['active']) ? 'text-apple-blue' : 'text-apple-dark'; ?>"><?php echo esc_html($item['label']); ?></a>
<?php endforeach; ?>
</div>
</div>
</header>
<main class="flex-grow">

2
home.php Normal file
View File

@@ -0,0 +1,2 @@
<?php
get_template_part('archive');

14
index.php Normal file
View File

@@ -0,0 +1,14 @@
<?php get_header(); ?>
<div class="pt-24 min-h-screen bg-apple-grey">
<div class="max-w-4xl mx-auto px-4 md:px-6 py-16">
<?php if (have_posts()): while (have_posts()): the_post(); ?>
<article class="bg-white p-6 rounded-2xl shadow-sm mb-6">
<h2 class="text-2xl font-bold text-apple-dark mb-3"><a href="<?php the_permalink(); ?>" class="hover:text-apple-blue"><?php the_title(); ?></a></h2>
<p class="text-gray-500"><?php the_excerpt(); ?></p>
</article>
<?php endwhile; gx_pagination(); else: ?>
<div class="text-center py-20 text-gray-500">暂无内容</div>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>

29
page-books.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
get_header();
$cfg = gx_asset_config();
?>
<div class="pt-24 min-h-screen bg-apple-grey animate-fade-in">
<div class="max-w-7xl mx-auto px-6 pb-20">
<div class="flex flex-col items-center text-center mb-16 pt-8">
<span class="bg-white border border-gray-200 text-gray-500 font-bold px-4 py-1.5 rounded-full text-xs mb-6 uppercase tracking-wider shadow-sm">Official Store</span>
<h1 class="text-4xl md:text-6xl font-semibold text-apple-dark mb-6">官方出版商城</h1>
<p class="text-xl text-gray-500 max-w-2xl font-light">针对天津专升本考纲编写,每年更新。累计销量突破 500,000 册。</p>
</div>
<div class="flex justify-center gap-4 mb-12 flex-wrap">
<?php foreach (array('全部','公共课','专业课','模拟卷','内部讲义') as $i => $cat): ?>
<button class="px-6 py-2 rounded-full text-sm font-medium transition-all <?php echo $i === 0 ? 'bg-black text-white shadow-lg' : 'bg-white text-gray-600 hover:bg-gray-100'; ?>"><?php echo esc_html($cat); ?></button>
<?php endforeach; ?>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-8">
<?php foreach ($cfg['books'] as $book): ?>
<div class="bg-white rounded-[2rem] p-8 flex flex-col items-center text-center shadow-sm hover:shadow-2xl hover:-translate-y-1 transition-all duration-300 group relative overflow-hidden">
<?php if (!empty($book['tag'])): ?><div class="absolute top-6 left-6 bg-red-500 text-white text-[10px] font-bold px-2 py-1 rounded-md"><?php echo esc_html($book['tag']); ?></div><?php endif; ?>
<div class="w-full aspect-[4/3] flex items-center justify-center mb-8 mt-4 gx-book gx-book-card-image max-w-[200px]"><img src="<?php echo esc_url($book['image']); ?>" alt="<?php echo esc_attr($book['title']); ?>"></div>
<div class="mt-auto w-full"><h3 class="text-xl font-bold text-apple-dark mb-2 truncate"><?php echo esc_html($book['title']); ?></h3><div class="flex items-center justify-center gap-3 mb-6"><span class="text-red-500 font-bold text-lg">¥<?php echo esc_html($book['price']); ?></span><span class="text-gray-400 text-sm line-through">¥<?php echo esc_html($book['old']); ?></span></div><button data-gx-modal-open="#gx-buy-modal" class="w-full py-3 rounded-full bg-apple-blue text-white font-medium text-sm hover:bg-apple-blue-hover transition-colors shadow-md hover:shadow-lg">立即购买</button></div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<div id="gx-buy-modal" class="gx-modal"><div class="gx-modal-backdrop"></div><div class="gx-modal-panel p-8 text-center"><button data-gx-modal-close class="absolute top-4 right-4 p-2 rounded-full hover:bg-gray-100">×</button><h3 class="text-2xl font-bold text-gray-900 mb-2">扫码添加客服</h3><p class="text-gray-500 mb-6">添加微信客服,了解购买详情</p><div class="bg-gray-50 rounded-2xl p-6 inline-block"><img src="<?php echo esc_url($cfg['customer_service_qrcode']); ?>" alt="客服二维码" class="w-64 h-64 rounded-lg"></div><p class="text-sm text-gray-400 mt-6">工作时间:周一至周日 9:00-21:00</p></div></div>
<?php get_footer(); ?>

37
page-online-school.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
get_header();
$cfg = gx_asset_config();
?>
<div class="pt-20 min-h-screen bg-slate-50 animate-fade-in pb-20">
<div class="relative bg-white border-b border-gray-100 overflow-hidden">
<div class="absolute top-0 right-0 w-[500px] h-[500px] bg-blue-50 rounded-full blur-[100px] opacity-60 pointer-events-none"></div>
<div class="max-w-7xl mx-auto px-6 py-16 md:py-24 relative z-10 text-center">
<span class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-blue-100 text-apple-blue text-xs font-bold tracking-wider uppercase mb-6"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.42 10.92a1 1 0 0 0-.02-1.84l-8.98-4a1 1 0 0 0-.84 0l-8.98 4a1 1 0 0 0-.02 1.84l8.98 4.2a1 1 0 0 0 .88 0z"/><path d="M22 10v6"/><path d="M6 12.5V16c0 1.1 2.69 2 6 2s6-.9 6-2v-3.5"/></svg>Gongxue Online</span>
<h1 class="text-4xl md:text-6xl font-bold text-apple-dark mb-6 leading-tight">线上好课,<span class="text-apple-blue">APP 随身学</span></h1>
<p class="text-lg md:text-xl text-gray-500 max-w-2xl mx-auto mb-10">不论在宿舍还是图书馆,打开恭学网校 APP 即可开始学习。最新考纲课程同步更新。</p>
<div class="flex flex-col md:flex-row justify-center items-center gap-6 mb-12">
<div class="flex gap-4 md:gap-8"><div class="text-center bg-white px-6 py-4 rounded-2xl shadow-sm border border-gray-100 min-w-[120px]"><div class="text-2xl md:text-3xl font-bold text-apple-dark">10W+</div><div class="text-xs text-gray-400">APP 下载量</div></div><div class="text-center bg-white px-6 py-4 rounded-2xl shadow-sm border border-gray-100 min-w-[120px]"><div class="text-2xl md:text-3xl font-bold text-apple-dark">4.9</div><div class="text-xs text-gray-400">学员好评</div></div></div>
<a href="https://www.gongxue100.com/mobile" target="_blank" rel="noreferrer" class="px-8 py-4 bg-apple-blue hover:bg-apple-blue-hover text-white rounded-full font-bold shadow-lg shadow-blue-200 transition-all hover:scale-105 flex items-center gap-2"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>下载恭学网校 APP</a>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto px-6 mt-12 grid grid-cols-1 lg:grid-cols-12 gap-12">
<div class="lg:col-span-7 space-y-8">
<div class="bg-white p-8 rounded-[2rem] shadow-sm border border-gray-100 flex flex-col md:flex-row gap-8 items-center">
<div class="flex-1"><div class="w-12 h-12 bg-blue-50 rounded-2xl flex items-center justify-center text-apple-blue mb-4"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/></svg></div><h3 class="text-2xl font-bold text-apple-dark mb-2">移动端学习系统</h3><p class="text-gray-500 text-sm mb-6">专为碎片化学习打造。支持倍速播放、离线缓存、后台播放。课程更新实时推送到手机。</p><a href="https://www.gongxue100.com/mobile" target="_blank" rel="noreferrer" class="inline-flex items-center text-apple-blue font-semibold text-sm hover:underline">前往下载 APP <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m9 18 6-6-6-6"/></svg></a></div>
<div class="w-full md:w-48 flex justify-center"><?php gx_phone_mockup($cfg['online_school_mockup'], 'scale-75 origin-center'); ?></div>
</div>
<div class="bg-white p-8 rounded-[2rem] shadow-sm border border-gray-100 flex flex-col md:flex-row gap-8 items-center">
<div class="flex-1"><div class="w-12 h-12 bg-purple-50 rounded-2xl flex items-center justify-center text-purple-600 mb-4"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/></svg></div><h3 class="text-2xl font-bold text-apple-dark mb-2">万人模考大赛</h3><p class="text-gray-500 text-sm mb-4">APP 内定期举办大型模拟考试,全真模拟考场环境。考后自动生成六维能力分析报告。</p><button class="text-purple-600 font-semibold text-sm hover:underline flex items-center gap-1">查看模考安排 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m9 18 6-6-6-6"/></svg></button></div>
<div class="w-full md:w-48 h-32 bg-gray-50 rounded-xl flex items-end justify-center px-4 pb-4 gap-2"><div class="w-3 h-[40%] bg-purple-200 rounded-t"></div><div class="w-3 h-[60%] bg-purple-300 rounded-t"></div><div class="w-3 h-[80%] bg-purple-500 rounded-t shadow-lg"></div><div class="w-3 h-[50%] bg-purple-200 rounded-t"></div></div>
</div>
</div>
<div class="lg:col-span-5">
<div class="bg-white p-8 rounded-[2rem] shadow-xl border border-blue-50 sticky top-24">
<div class="flex items-center gap-3 mb-6"><div class="p-2 bg-gradient-to-br from-orange-100 to-amber-100 text-orange-600 rounded-xl"><svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z"/><circle cx="12" cy="10" r="3"/></svg></div><div><h3 class="font-bold text-xl text-apple-dark">咨询课程顾问</h3><p class="text-xs text-gray-500">线上/线下班型 1对1 规划</p></div></div>
<iframe src="https://baoming.gongxue100.com/f/xFYow5?background=white&banner=show&embedded=true&inner_redirect=false" width="100%" height="800" frameborder="0" style="border:none;border-radius:1rem;background:#f9fafb"></iframe>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>

36
page-question-bank.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
get_header();
$cfg = gx_asset_config();
?>
<div class="pt-24 min-h-screen bg-white animate-fade-in">
<div class="max-w-7xl mx-auto px-6 py-20">
<div class="flex flex-col lg:flex-row items-center gap-20 lg:gap-24 mb-32 md:mb-40">
<div class="flex-1 text-center lg:text-left">
<div class="inline-block px-4 py-1.5 border border-blue-100 rounded-full bg-blue-50 text-apple-blue font-bold text-xs tracking-wider uppercase mb-8">Gongxue Question Bank V4.0</div>
<h1 class="text-5xl md:text-7xl font-semibold text-apple-dark mb-8 leading-[1.1]">刷题,<br><span class="text-apple-blue">从未如此智能。</span></h1>
<p class="text-lg md:text-2xl text-apple-text-gray mb-12 leading-relaxed max-w-lg mx-auto lg:mx-0 font-light">极致窄边框设计,视野全开。双端数据实时同步。天津专升本历年真题超过 100,000 道,全都在这儿。</p>
<div class="flex flex-col sm:flex-row gap-5 justify-center lg:justify-start">
<button data-gx-modal-open="#gx-qrcode-modal" class="bg-apple-dark text-white px-9 py-4 rounded-full font-bold hover:scale-105 transition-all shadow-xl text-lg">立即扫码刷题</button>
<button class="bg-gray-100 text-apple-dark px-9 py-4 rounded-full font-bold hover:bg-gray-200 transition-all text-lg">了解 SVIP 权益</button>
</div>
</div>
<div class="flex-1 w-full flex justify-center">
<div class="relative w-full max-w-[340px]"><div class="absolute inset-0 bg-gradient-to-tr from-blue-200 to-purple-200 rounded-full blur-[100px] opacity-50"></div><?php gx_phone_mockup($cfg['question_bank_mockup'], 'animate-float'); ?></div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-10 lg:gap-12 mb-32 items-start">
<div class="bg-gray-50 rounded-[3rem] p-10 md:p-14 overflow-hidden relative group flex flex-col">
<div class="relative z-10 mb-8"><div class="inline-flex px-3 py-1 rounded-full bg-white border border-gray-200 text-xs font-bold text-gray-500 mb-5 uppercase tracking-wider">Focus Mode</div><h3 class="text-4xl font-bold text-apple-dark mb-4">沉浸刷题,<br>全屏专注。</h3><p class="text-gray-500 text-lg">进入刷题模式,我们移除了干扰元素。让视野完全回归题目本身。</p></div>
<div class="mt-8 flex justify-center"><div class="w-[85%] shadow-2xl rounded-[2.5rem] overflow-hidden border-[8px] border-white translate-y-10 group-hover:translate-y-5 transition-transform duration-500"><img src="<?php echo esc_url($cfg['question_bank_mockup']); ?>" class="w-full h-auto" alt="Focus Mode UI"></div></div>
</div>
<div class="bg-black rounded-[3rem] p-10 md:p-14 overflow-hidden relative text-white group flex flex-col">
<div class="relative z-10 mb-12"><div class="inline-flex px-3 py-1 rounded-full bg-white/10 border border-white/20 text-xs font-bold text-gray-300 mb-5 uppercase tracking-wider">Data Insight</div><h3 class="text-4xl font-bold mb-4">数据看板,<br>心中有数。</h3><p class="text-gray-400 text-lg">直观展示你的刷题量、正确率趋势以及薄弱知识点。</p></div>
<div class="grid grid-cols-2 gap-6 mb-8"><div class="bg-white/10 rounded-2xl p-6 border border-white/10"><div class="text-3xl font-bold mb-1">100<span class="text-sm text-gray-400">%</span></div><div class="text-xs text-gray-400 font-bold uppercase">真题覆盖</div></div><div class="bg-white/10 rounded-2xl p-6 border border-white/10"><div class="text-3xl font-bold mb-1 text-yellow-400">⚡</div><div class="text-xs text-gray-400 font-bold uppercase">智能错题本</div></div></div>
<div class="bg-white/5 rounded-2xl p-6 border border-white/5"><div class="flex justify-between items-end h-24 gap-2"><?php foreach (array(30,45,25,60,75,50,80) as $h): ?><div class="w-full bg-gray-700/50 rounded-t-sm relative overflow-hidden"><div style="height:<?php echo esc_attr($h); ?>%" class="absolute bottom-0 w-full bg-gradient-to-t from-apple-blue to-purple-500"></div></div><?php endforeach; ?></div><div class="flex justify-between mt-3 text-[10px] text-gray-500 uppercase font-bold"><span>Mon</span><span>Tue</span><span>Wed</span><span>Thu</span><span>Fri</span><span>Sat</span><span>Sun</span></div></div>
</div>
</div>
</div>
</div>
<div id="gx-qrcode-modal" class="gx-modal"><div class="gx-modal-backdrop"></div><div class="gx-modal-panel p-8 text-center"><button data-gx-modal-close class="absolute top-4 right-4 p-2 rounded-full hover:bg-gray-100">×</button><h3 class="text-2xl font-bold text-gray-900 mb-2">扫码添加客服</h3><p class="text-gray-500 mb-6">添加微信客服,获取刷题小程序</p><div class="bg-gray-50 rounded-2xl p-6 inline-block"><img src="<?php echo esc_url($cfg['customer_service_qrcode']); ?>" alt="客服微信二维码" class="w-64 h-64 rounded-lg"></div><p class="text-sm text-gray-400 mt-6">工作时间:周一至周日 9:00-21:00</p></div></div>
<?php get_footer(); ?>

105
setup-demo.php Normal file
View File

@@ -0,0 +1,105 @@
<?php
define('WP_USE_THEMES', false);
require '/var/www/html/wp-load.php';
$site_url = getenv('GX_SITE_URL') ?: 'http://81.70.133.57:8080';
function gx_ensure_page($title, $slug, $template = '') {
$page = get_page_by_path($slug, OBJECT, 'page');
$data = array('post_title' => $title, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'page', 'post_content' => '');
if ($page) { $data['ID'] = $page->ID; $id = wp_update_post($data); } else { $id = wp_insert_post($data); }
if (!is_wp_error($id) && $template) update_post_meta($id, '_wp_page_template', $template);
return is_wp_error($id) ? 0 : $id;
}
function gx_ensure_cat($name, $slug) { $term = get_category_by_slug($slug); if ($term) return $term->term_id; $created = wp_insert_term($name, 'category', array('slug' => $slug)); return is_wp_error($created) ? 1 : intval($created['term_id']); }
function gx_upsert_post($data, $cat_id) {
$existing = get_page_by_path($data['slug'], OBJECT, 'post');
$post = array('post_title'=>$data['title'],'post_name'=>$data['slug'],'post_content'=>$data['content'],'post_excerpt'=>$data['excerpt'],'post_type'=>'post','post_status'=>'publish','post_date'=>$data['date'].' 09:00:00','post_category'=>array($cat_id),'tags_input'=>$data['tags']);
if ($existing) { $post['ID'] = $existing->ID; $id = wp_update_post($post); } else { $id = wp_insert_post($post); }
if (!is_wp_error($id)) update_post_meta($id, '_gx_view_count', intval($data['views']));
return $id;
}
function gx_ensure_menu_location($location, $menu_name) {
$locations = get_theme_mod('nav_menu_locations', array());
$menu = wp_get_nav_menu_object($menu_name);
if (!$menu) {
$menu_id = wp_create_nav_menu($menu_name);
$menu = wp_get_nav_menu_object($menu_id);
}
if ($menu && !empty($menu->term_id)) {
$locations[$location] = (int) $menu->term_id;
set_theme_mod('nav_menu_locations', $locations);
}
return $menu && !empty($menu->term_id) ? (int) $menu->term_id : 0;
}
switch_theme('gongxue-from-zero');
wp_delete_post(1, true);
$hello = get_page_by_title('Hello world!', OBJECT, 'post');
if ($hello) {
wp_delete_post($hello->ID, true);
}
$home_id = gx_ensure_page('首页', 'home', 'front-page.php');
$knowledge_id = gx_ensure_page('知识库', 'knowledge');
gx_ensure_page('刷题题库', 'question-bank', 'page-question-bank.php');
gx_ensure_page('在线网校', 'online-school', 'page-online-school.php');
gx_ensure_page('出版书籍', 'books', 'page-books.php');
update_option('show_on_front', 'page');
update_option('page_on_front', $home_id);
update_option('page_for_posts', $knowledge_id);
update_option('home', $site_url);
update_option('siteurl', $site_url);
update_option('blogname', '恭学教育');
update_option('blogdescription', '天津专升本智慧教育平台');
update_option('posts_per_page', 10);
update_option('default_category', 1);
update_option('blog_public', 1);
update_option('timezone_string', 'Asia/Shanghai');
$cats = array('考试政策'=>'exam-policy','院校专业'=>'school-intro','专业指南'=>'major-guide','复习规划'=>'study-method','学长经验'=>'experience');
$cat_ids = array(); foreach ($cats as $name => $slug) $cat_ids[$name] = gx_ensure_cat($name, $slug);
$posts = array(
array('title'=>'2026年天津高职升本科考试报名热点问答发布','slug'=>'2026-tianjin-zhuanshengben-registration-faq','content'=>'<p>天津市教育招生考试院近日发布了2026年天津市高职升本科招生工作安排。</p><h2>一、报名条件</h2><p>符合下列条件的人员,具备报名资格。</p>','excerpt'=>'最新报名政策详解。','category'=>'考试政策','tags'=>array('置顶','官方','必读'),'date'=>'2026-01-15','views'=>23800,'sticky'=>true),
array('title'=>'天津专升本2026年院校专业选择攻略','slug'=>'2026-tianjin-school-major-guide','content'=>'<p>天津专升本招生院校众多,专业选择复杂。</p>','excerpt'=>'全面梳理天津各大本科院校专升本招生专业。','category'=>'院校专业','tags'=>array('干货','必读'),'date'=>'2026-01-08','views'=>12700),
array('title'=>'高数复习黄金期,如何利用刷题题库高效提分?','slug'=>'advanced-math-question-bank-study-plan','content'=>'<p>专升本高数考试临近,如何高效利用刷题题库提升成绩?</p>','excerpt'=>'冲刺阶段的高数复习策略。','category'=>'复习规划','tags'=>array('干货','热门'),'date'=>'2026-01-05','views'=>8300),
array('title'=>'专升本英语核心词汇如何分阶段记忆','slug'=>'english-vocabulary-stage-memory','content'=>'<p>英语词汇复习不是简单重复背诵。</p>','excerpt'=>'把高频词、真题语境和错题复盘结合起来。','category'=>'专业指南','tags'=>array('英语','方法'),'date'=>'2025-12-28','views'=>4600),
array('title'=>'从专科到本科学姐的380天复习心路历程','slug'=>'student-success-380-days','content'=>'<p>我是天津某专科院校2025届毕业生。</p>','excerpt'=>'380天备考之路。','category'=>'学长经验','tags'=>array('经验','热门'),'date'=>'2025-12-20','views'=>11200),
);
$sticky = array();
foreach ($posts as $p) { $id = gx_upsert_post($p, $cat_ids[$p['category']] ?? 1); if (!empty($p['sticky'])) $sticky[] = $id; }
update_option('sticky_posts', $sticky);
update_option('seo_title', '恭学教育 - 天津专升本培训领军品牌 | 刷题题库 | 在线网校 | 出版书籍');
update_option('seo_description', '恭学教育专注天津专升本 7 年,提供刷题题库、在线网校、出版书籍和知识库文章,帮助学员高效升本。');
update_option('seo_keywords', '天津专升本,恭学教育,刷题题库,在线网校,出版书籍,知识库');
if ($home_id && $knowledge_id) {
$menu_id = gx_ensure_menu_location('primary', '主导航菜单');
if ($menu_id) {
$existing_items = wp_get_nav_menu_items($menu_id, array('post_status' => 'publish'));
$existing_titles = array();
foreach ($existing_items as $menu_item) {
$existing_titles[] = trim($menu_item->title);
}
$items = array(
array('title' => '首页', 'object_id' => $home_id, 'object' => 'page', 'type' => 'post_type', 'url' => get_permalink($home_id)),
array('title' => '刷题题库', 'object_id' => (get_page_by_path('question-bank', OBJECT, 'page') ? get_page_by_path('question-bank', OBJECT, 'page')->ID : 0), 'object' => 'page', 'type' => 'post_type', 'url' => home_url('/question-bank/')),
array('title' => '在线网校', 'object_id' => (get_page_by_path('online-school', OBJECT, 'page') ? get_page_by_path('online-school', OBJECT, 'page')->ID : 0), 'object' => 'page', 'type' => 'post_type', 'url' => home_url('/online-school/')),
array('title' => '出版书籍', 'object_id' => (get_page_by_path('books', OBJECT, 'page') ? get_page_by_path('books', OBJECT, 'page')->ID : 0), 'object' => 'page', 'type' => 'post_type', 'url' => home_url('/books/')),
array('title' => '知识库', 'object_id' => $knowledge_id, 'object' => 'page', 'type' => 'post_type', 'url' => get_permalink($knowledge_id)),
);
foreach ($items as $item) {
if (!in_array($item['title'], $existing_titles, true) && !empty($item['object_id'])) {
wp_update_nav_menu_item($menu_id, 0, array(
'menu-item-title' => $item['title'],
'menu-item-object-id' => $item['object_id'],
'menu-item-object' => $item['object'],
'menu-item-type' => $item['type'],
'menu-item-status' => 'publish',
'menu-item-url' => $item['url'],
));
}
}
}
}
update_option('permalink_structure', '/%postname%/');
flush_rewrite_rules();
echo "ok\n";

64
single.php Normal file
View File

@@ -0,0 +1,64 @@
<?php get_header(); ?>
<div class="pt-24 min-h-screen bg-apple-grey animate-fade-in">
<div class="max-w-4xl mx-auto px-4 md:px-6 pb-20">
<?php while (have_posts()): the_post(); $cats = get_the_category(); $primary = !empty($cats) ? $cats[0] : null; $tags = get_the_tags(); ?>
<a href="<?php echo esc_url(gx_knowledge_url()); ?>" class="inline-flex items-center gap-2 text-gray-500 hover:text-apple-blue mb-8 transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>返回知识库
</a>
<article <?php post_class('bg-white rounded-3xl shadow-sm overflow-hidden'); ?>>
<?php if (has_post_thumbnail()): ?><div class="w-full h-48 md:h-72 overflow-hidden"><?php the_post_thumbnail('large', array('class' => 'w-full h-full object-cover')); ?></div><?php endif; ?>
<div class="p-6 md:p-10 border-b border-gray-100">
<div class="flex flex-wrap items-center gap-2 mb-4">
<?php if ($primary): ?><span class="bg-apple-blue/10 text-apple-blue text-xs font-medium px-3 py-1 rounded-full"><?php echo esc_html($primary->name); ?></span><?php endif; ?>
<?php if (is_sticky(get_the_ID())): ?><span class="bg-orange-100 text-orange-600 text-xs font-medium px-3 py-1 rounded-full">置顶</span><?php endif; ?>
<?php if ($tags): foreach (array_slice($tags, 0, 3) as $tag): ?><a href="<?php echo esc_url(get_tag_link($tag)); ?>" class="bg-gray-100 text-gray-600 text-xs px-2 py-0.5 rounded-full hover:text-apple-blue">#<?php echo esc_html($tag->name); ?></a><?php endforeach; endif; ?>
</div>
<h1 class="text-2xl md:text-3xl font-bold text-gray-900 mb-6 leading-tight"><?php the_title(); ?></h1>
<div class="flex flex-wrap items-center gap-4 text-sm text-gray-500">
<span class="flex items-center gap-1"><span class="w-6 h-6 bg-apple-blue/10 rounded-full flex items-center justify-center text-xs text-apple-blue font-medium">G</span><?php the_author(); ?></span>
<span class="flex items-center gap-1"><?php echo esc_html(get_the_date('Y年n月j日')); ?></span>
<span class="flex items-center gap-1"><?php echo esc_html(gx_format_views(gx_get_views())); ?> 阅读</span>
</div>
</div>
<?php if (has_excerpt()): ?><div class="px-6 md:px-10 py-4 bg-blue-50/50 border-b border-blue-100"><p class="text-sm text-blue-800 leading-relaxed italic"><?php echo esc_html(get_the_excerpt()); ?></p></div><?php endif; ?>
<div class="p-6 md:p-10"><div class="prose prose-gongxue max-w-none"><?php the_content(); ?></div></div>
<div class="p-6 md:p-10 bg-gray-50 border-t border-gray-100 flex items-center justify-between">
<span class="text-gray-500">知识库</span>
<button class="gx-share flex items-center gap-2 px-6 py-2 bg-white border border-gray-200 rounded-full text-gray-600 hover:bg-gray-50 transition-colors" data-url="<?php the_permalink(); ?>" data-title="<?php the_title_attribute(); ?>">分享文章</button>
</div>
</article>
<?php
$related_args = array(
'post__not_in' => array(get_the_ID()),
'posts_per_page' => 3,
'ignore_sticky_posts' => true,
);
if ($primary) {
$related_args['cat'] = $primary->term_id;
}
$related = new WP_Query($related_args);
if (!$related->have_posts()) {
$related = new WP_Query(array(
'post__not_in' => array(get_the_ID()),
'posts_per_page' => 3,
'ignore_sticky_posts' => true,
));
}
if ($related->have_posts()):
?>
<section class="mt-10">
<h2 class="text-xl font-bold text-apple-dark mb-6">相关文章</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<?php while ($related->have_posts()): $related->the_post(); $rcats = get_the_category(); $rname = !empty($rcats) ? $rcats[0]->name : '文章'; ?>
<a href="<?php the_permalink(); ?>" class="bg-white p-5 rounded-2xl shadow-sm hover:shadow-md transition-all group">
<h3 class="font-semibold text-gray-900 group-hover:text-apple-blue transition-colors line-clamp-2 text-sm"><?php the_title(); ?></h3>
<div class="flex items-center gap-3 mt-2 text-xs text-gray-400"><span><?php echo esc_html($rname); ?></span><span><?php echo esc_html(gx_format_views(gx_get_views($related->post->ID))); ?> 阅读</span></div>
</a>
<?php endwhile; wp_reset_postdata(); ?>
</div>
</section>
<?php endif; ?>
<?php endwhile; ?>
</div>
</div>
<?php get_footer(); ?>

8
style.css Normal file
View File

@@ -0,0 +1,8 @@
/*
Theme Name: Gongxue From Zero
Theme URI: https://www.gongxue100.com
Author: Codex
Description: Gongxue education theme rebuilt from reference UI.
Version: 1.0.0
Text Domain: gongxue
*/