commit 043faa8b9841df1be463c9d58bbca27af340de55 Author: wangziqi Date: Thu Jun 25 15:57:22 2026 +0800 Initial WordPress theme diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d571c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +.DS_Store +Thumbs.db + +.idea/ +.vscode/ +*.swp +*.swo + +node_modules/ +vendor/ + +*.log +*.tmp + +wp-content/uploads/ +wp-content/cache/ diff --git a/archive.php b/archive.php new file mode 100644 index 0000000..4ccf146 --- /dev/null +++ b/archive.php @@ -0,0 +1,99 @@ + '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()); +} +?> +
+
+
+
+ +
+
+

+

+
+ +
+ + + +
+ 全部 + + name); ?> + +
+ + +
+ + #name); ?> + +
+ + +
+ + +
+ name : '文章'; $tags = get_the_tags(); ?> +
+
+ +
+

+ 置顶 + +

+ +
+ + 阅读 + + + #name); ?> + +
+
+
+
+ +
暂无内容
+ +
+
+
+
+ diff --git a/assets/css/main.css b/assets/css/main.css new file mode 100644 index 0000000..099ddf5 --- /dev/null +++ b/assets/css/main.css @@ -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)}} diff --git a/assets/images/customer-service-qrcode.jpg b/assets/images/customer-service-qrcode.jpg new file mode 100644 index 0000000..969214b Binary files /dev/null and b/assets/images/customer-service-qrcode.jpg differ diff --git a/assets/images/logo.png b/assets/images/logo.png new file mode 100644 index 0000000..ee65c9f Binary files /dev/null and b/assets/images/logo.png differ diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..3f750d3 --- /dev/null +++ b/assets/js/main.js @@ -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(); + }); +})(); diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d65100f --- /dev/null +++ b/docker-compose.yml @@ -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 + + 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] + + # 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: diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..0c98617 --- /dev/null +++ b/footer.php @@ -0,0 +1,64 @@ + + + + +
+ + +
+

在线客服

在线

G

你好同学,正在接入人工客服,您也可以先扫码添加微信沟通。

客服二维码

工作时间:周一至周日 9:00-21:00

+ + + diff --git a/front-page.php b/front-page.php new file mode 100644 index 0000000..c904044 --- /dev/null +++ b/front-page.php @@ -0,0 +1,138 @@ + 'post', 'posts_per_page' => 5, 'ignore_sticky_posts' => false)); +?> +
+
+
+
+
+
+
+
+ + + 恭学教育,天津专升本轻奢品牌 + +
+

+ 赋能未来,
让升本更简单。 +

+
+ + Brand Video Cover + +
+

了解恭学教育

+

观看 2025 年度品牌宣传片

+
+
+
+ 开始学习 + 大数据中心 + +
+
+
+ +
+ +
+ +
+
+
0+
年专注专升本
+
累计服务学员
+
真题覆盖率
+
0所
合作院校
+
+
+ +
+
+
Corporate Culture

企业文化

+
+ +

+ +
+
+
+ +
+
恭学愿景

种种用心,只为你能省心

不懈探索、勇于突破、脚踏实地、求真务实。

+
+ +
+
Dedicated Member

核心团队

+
<?php echo esc_attr($member['name']); ?>

+
+
+ +
+

行业动态 & 咨询

查看更多 ›
+ have_posts()): while ($news->have_posts()): $news->the_post(); $cats = get_the_category(); $cat = !empty($cats) ? $cats[0]->name : '文章'; ?> +

+ +
+
+
+ +
+
+
+ +

扫码添加客服

+

添加微信客服,获取课程规划

+
客服二维码
+

工作时间:周一至周日 9:00-21:00

+
+
+ diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..27bed3a --- /dev/null +++ b/functions.php @@ -0,0 +1,279 @@ + 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 '
'; +} + +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' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + )); +} +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 '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\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 '' . "\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 = '') { + ?> +
+
+
+
+ App Screen +
+
+
+
+ + +> + + + + + +> + + + +
diff --git a/home.php b/home.php new file mode 100644 index 0000000..7b2138d --- /dev/null +++ b/home.php @@ -0,0 +1,2 @@ + +
+
+ +
+

+

+
+ +
暂无内容
+ +
+
+ diff --git a/page-books.php b/page-books.php new file mode 100644 index 0000000..6c069fb --- /dev/null +++ b/page-books.php @@ -0,0 +1,29 @@ + +
+
+
+ Official Store +

官方出版商城

+

针对天津专升本考纲编写,每年更新。累计销量突破 500,000 册。

+
+
+ $cat): ?> + + +
+
+ +
+
+
<?php echo esc_attr($book['title']); ?>
+

¥¥
+
+ +
+
+
+

扫码添加客服

添加微信客服,了解购买详情

客服二维码

工作时间:周一至周日 9:00-21:00

+ diff --git a/page-online-school.php b/page-online-school.php new file mode 100644 index 0000000..ad9be68 --- /dev/null +++ b/page-online-school.php @@ -0,0 +1,37 @@ + +
+
+
+
+ Gongxue Online +

线上好课,APP 随身学

+

不论在宿舍还是图书馆,打开恭学网校 APP 即可开始学习。最新考纲课程同步更新。

+
+
10W+
APP 下载量
4.9
学员好评
+ 下载恭学网校 APP +
+
+
+
+
+
+

移动端学习系统

专为碎片化学习打造。支持倍速播放、离线缓存、后台播放。课程更新实时推送到手机。

前往下载 APP
+
+
+
+

万人模考大赛

APP 内定期举办大型模拟考试,全真模拟考场环境。考后自动生成六维能力分析报告。

+
+
+
+
+
+

咨询课程顾问

线上/线下班型 1对1 规划

+ +
+
+
+
+ diff --git a/page-question-bank.php b/page-question-bank.php new file mode 100644 index 0000000..576b622 --- /dev/null +++ b/page-question-bank.php @@ -0,0 +1,36 @@ + +
+
+
+
+
Gongxue Question Bank V4.0
+

刷题,
从未如此智能。

+

极致窄边框设计,视野全开。双端数据实时同步。天津专升本历年真题超过 100,000 道,全都在这儿。

+
+ + +
+
+
+
+
+
+ +
+
+
Focus Mode

沉浸刷题,
全屏专注。

进入刷题模式,我们移除了干扰元素。让视野完全回归题目本身。

+
Focus Mode UI
+
+
+
Data Insight

数据看板,
心中有数。

直观展示你的刷题量、正确率趋势以及薄弱知识点。

+
100%
真题覆盖
智能错题本
+
MonTueWedThuFriSatSun
+
+
+
+
+

扫码添加客服

添加微信客服,获取刷题小程序

客服微信二维码

工作时间:周一至周日 9:00-21:00

+ diff --git a/setup-demo.php b/setup-demo.php new file mode 100644 index 0000000..f61e2c1 --- /dev/null +++ b/setup-demo.php @@ -0,0 +1,105 @@ + $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'=>'

天津市教育招生考试院近日发布了2026年天津市高职升本科招生工作安排。

一、报名条件

符合下列条件的人员,具备报名资格。

','excerpt'=>'最新报名政策详解。','category'=>'考试政策','tags'=>array('置顶','官方','必读'),'date'=>'2026-01-15','views'=>23800,'sticky'=>true), + array('title'=>'天津专升本2026年院校专业选择攻略','slug'=>'2026-tianjin-school-major-guide','content'=>'

天津专升本招生院校众多,专业选择复杂。

','excerpt'=>'全面梳理天津各大本科院校专升本招生专业。','category'=>'院校专业','tags'=>array('干货','必读'),'date'=>'2026-01-08','views'=>12700), + array('title'=>'高数复习黄金期,如何利用刷题题库高效提分?','slug'=>'advanced-math-question-bank-study-plan','content'=>'

专升本高数考试临近,如何高效利用刷题题库提升成绩?

','excerpt'=>'冲刺阶段的高数复习策略。','category'=>'复习规划','tags'=>array('干货','热门'),'date'=>'2026-01-05','views'=>8300), + array('title'=>'专升本英语核心词汇如何分阶段记忆','slug'=>'english-vocabulary-stage-memory','content'=>'

英语词汇复习不是简单重复背诵。

','excerpt'=>'把高频词、真题语境和错题复盘结合起来。','category'=>'专业指南','tags'=>array('英语','方法'),'date'=>'2025-12-28','views'=>4600), + array('title'=>'从专科到本科:学姐的380天复习心路历程','slug'=>'student-success-380-days','content'=>'

我是天津某专科院校2025届毕业生。

','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"; diff --git a/single.php b/single.php new file mode 100644 index 0000000..25c7594 --- /dev/null +++ b/single.php @@ -0,0 +1,64 @@ + +
+
+ + + 返回知识库 + +
> +
'w-full h-full object-cover')); ?>
+
+
+ name); ?> + 置顶 + #name); ?> +
+

+
+ G + + 阅读 +
+
+

+
+
+ 知识库 + +
+
+ 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()): + ?> +
+

相关文章

+
+ have_posts()): $related->the_post(); $rcats = get_the_category(); $rname = !empty($rcats) ? $rcats[0]->name : '文章'; ?> + +

+
post->ID))); ?> 阅读
+
+ +
+
+ + +
+
+ diff --git a/style.css b/style.css new file mode 100644 index 0000000..8d170cc --- /dev/null +++ b/style.css @@ -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 +*/