三个自定义文章类型(project、testimonial、faq_item)驱动作品、评价与 FAQ 的动态展示
asadazam-portfolio-theme — WordPress 作品集模板
作者 asadazam-dev
一个从零手写的 WordPress 作品集主题,通过自定义文章类型与 PHP 中定义的 ACF 字段驱动项目、评价与 FAQ 展示,演示站点为 kreativehive.net/portfolio。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
ACF 字段组以 PHP 定义并纳入版本控制,部署到新环境时字段自动出现
functions.php 仅作引导,功能拆分为 inc/ 模块与 template-parts/ 区块组件
明暗主题通过 data-theme 属性与 CSS 变量切换,状态持久化在 localStorage
README 记录了异步字体、脚本 defer、精简 head 等性能处理方式(作者自述,未独立核验)
模板详细介绍
这是一个不依赖页面构建器或起始框架、从零编写的 WordPress 作品集主题。它同时作为作者的个人作品集站点(kreativehive.net/portfolio)和公开代码示例,动态内容由三个自定义文章类型支撑:project(作品卡片,带 project_category 分类法)、testimonial(客户评价)和 faq_item(FAQ 条目),均在 inc/cpt.php 中注册并支持 REST,主题启用时自动写入默认项目分类。ACF 字段组写在 PHP 文件(inc/acf-fields.php)而非数据库,覆盖项目字段、评价字段与站点选项页,便于纳入版本控制与跨环境部署。模板遵循 WordPress 模板层级,functions.php 仅做引导,各功能拆分为 inc/ 下的模块与 template-parts/ 下的区块组件。主题内置明暗两套配色,通过 html 上的 data-theme 属性切换,状态存于 localStorage,首次访问参考 prefers-color-scheme。README 中列出的性能处理包括异步加载 Google Fonts、脚本 defer、精简 head 输出、移除 emoji 脚本以及用 filemtime() 做开发环境缓存失效;这些为作者自述,未在本次资料中独立核验。使用前需注意:主题依赖 Advanced Custom Fields 插件(免费版即可),README 建议 WordPress 6.0+ 与 PHP 8.0+,但具体版本要求请以仓库当前说明为准。代码采用 MIT 许可,可自由使用、修改与分发;演示中的图片、字体、图标等第三方素材需单独核对许可。
适合你的项目吗?
适用场景
- 搭建以项目卡片为核心的个人作品集或自由职业者展示站
- 需要把 ACF 字段定义纳入 Git、跨环境部署 WordPress 站点的团队
- 作为学习自定义文章类型、模板层级与模块化主题结构的参考代码
适合人群
- 熟悉 WordPress 主题结构、能自行配置 ACF 字段与后台选项的开发者
- 希望以纯 CSS/JS、无构建步骤方式维护单页作品集的人
- 需要 MIT 许可下可自由修改与分发主题代码的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
将主题文件夹放入 /wp-content/themes/,安装并启用 Advanced Custom Fields 插件后激活主题
- 2
主题激活时会自动写入 CPT 与默认项目分类,随后在后台添加项目、评价与 FAQ 条目
- 3
在后台 Portfolio Settings 中配置 hero 文案与联系方式,并在 设置 → 阅读 中决定首页显示方式
- 4
README 建议 WordPress 6.0+ 与 PHP 8.0+,实际环境要求请以仓库当前说明为准
- 5
演示图片、字体、图标等第三方素材需按各自许可单独核对,不随代码的 MIT 许可一并授权
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 主题依赖 Advanced Custom Fields 插件才能正常工作,需自行安装并启用该插件(免费版即可)。
- 运行环境要求 WordPress 6.0 及以上、PHP 8.0 及以上,低于该版本可能无法正常使用。
- README 建议搭配 Rank Math SEO 或 Yoast 等插件,属于可选推荐,非强制要求。
- 如需可靠的邮件发送,README 建议额外安装 WP Mail SMTP 插件,涉及第三方服务配置。
- README 建议使用缓存插件(如 WP Rocket、LiteSpeed)以优化性能,部分为付费插件。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Advanced Custom Fields plugin (free version is enough)
README 原文
WordPress 6.0+ - PHP 8.0+
README 原文
Rank Math SEO (or Yoast)
README 原文
WP Mail SMTP (reliable email delivery)
README 原文
https://github.com/asadazam-dev/asadazam-portfolio-theme/blob/main/LICENSEhttps://github.com/asadazam-dev/asadazam-portfolio-theme/blob/main/README.mdA caching plugin (WP Rocket, LiteSpeed, etc.)
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-04。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 80 / 100
- 技术栈
- WordPress
- 网站类型
- 作品集
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-05-15
- 截图检查日期
- 2026-10-04
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 WordPress。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-04
查看当时使用的来源资料
SHA-256: e5515b73fef1108ebdf0f190ce50bbe8ff1be2b7dc4c48fb280b952c1ee7d788
2026-10-04T02:44:40.461Z
来源文件 / 仓库# Asad Azam Portfolio Theme
A custom WordPress theme built from scratch. No page builders, no starter frameworks, no shortcuts.
🌐 **Live site:** [kreativehive.net/portfolio](https://kreativehive.net/portfolio/)
👤 **Author:** Asad Azam — Senior WordPress Developer & WooCommerce Specialist
📍 **Based in:** Karachi, Pakistan
💼 **Status:** Open to senior full-time roles (remote & on-site) and select freelance WooCommerce projects
---
## What this is
This is both my portfolio *and* a public code sample. Every section of the live portfolio is also a worked example of something I do for clients:
- Custom Post Types & taxonomies (work grid, testimonials, FAQ)
- ACF field groups registered in PHP (version-controlled, deploy-friendly)
- ACF Options page for global site settings
- Modular template parts following the WordPress template hierarchy
- Properly enqueued assets with cache-busting via `filemtime()` in dev
- Performance baseline: 96 PageSpeed desktop, 85+ mobile (Core Web Vitals: TBT 0, CLS 0)
- Light/dark theme with localStorage persistence
- Async-loaded Google Fonts (non-render-blocking)
- Accessibility-first: semantic HTML, ARIA labels, keyboard navigation
If you're evaluating my work for a senior WordPress role, the source of this theme is the proof.
---
## Architecture
```
asadazam-portfolio-theme/
├── style.css Theme metadata header (intentionally minimal)
├── functions.php Bootstrap — loads modular includes
├── front-page.php Single-page orchestrator
├── index.php Fallback template
├── header.php <head>, status bar, sticky nav
├── footer.php Footer + floating WhatsApp + closing tags
├── 404.php Branded 404 page
├── readme.md Internal dev-focused docs
│
├── inc/
│ ├── theme-setup.php add_theme_support, menus, image sizes
│ ├── enqueue.php CSS/JS loading + performance hooks
│ ├── cpt.php 3 CPTs + 1 taxonomy + activation seeders
│ ├── acf-fields.php ACF field groups defined in PHP
│ └── helpers.php asadazam_field(), asadazam_option(), URL helpers
│
├── template-parts/ Modular section components
│ ├── hero.php Hero with animated dashboard graphic
│ ├── marquee.php Skill scroller
│ ├── now.php "Currently working on" cards (ACF Options)
│ ├── stats.php Animated counter cards
│ ├── about.php Personal copy
│ ├── work-grid.php ⭐ Dynamic — pulls from project CPT
│ ├── capabilities.php Expertise cards
│ ├── testimonials.php ⭐ Dynamic — pulls from testimonial CPT
│ ├── process.php How I work — 4 steps
│ ├── faq.php ⭐ Dynamic — pulls from faq_item CPT
│ └── contact.php CTA + contact channels (ACF Options)
│
└── assets/
├── css/main.css Minified production CSS (~38KB)
└── js/main.js Minified production JS (~4KB)
```
---
## Custom Post Types
Three CPTs power the dynamic portions of the portfolio:
| CPT | Purpose | Taxonomy |
| ------------- | -------------------------------- | ------------------- |
| `project` | Portfolio work cards | `project_category` |
| `testimonial` | Client quotes | none |
| `faq_item` | FAQ accordion entries | none |
Each is registered in `inc/cpt.php` with proper labels, capabilities, and REST support (so they work in the Gutenberg editor and the WP REST API). Default project categories are seeded automatically on theme activation: *Custom Themes*, *WooCommerce*, *Service Sites*.
---
## ACF Field Groups (defined in PHP)
Defining ACF field groups in PHP (instead of only in the database) is a senior pattern that:
- Keeps field definitions in version control
- Makes it easy to deploy field changes across environments
- Prevents the "works on my machine, breaks in production" problem
See `inc/acf-fields.php` for the implementation. Field groups cover:
- **Project fields** — URL, color skin, brand chip, metric chip, project number, tags
- **Testimonial fields** — role, initials, featured boolean
- **Site Options** — hero copy, "now" cards repeater, contact info
---
## Performance Optimizations
Real techniques implemented in this theme, with measurable impact on Lighthouse scores:
- **Async Google Fonts** — non-blocking `<link rel="preload">` swap pattern saves ~1,700ms render-blocking time
- **Deferred JavaScript** — `<script defer>` so JS never blocks LCP
- **Minified production CSS/JS** — 28% size reduction
- **Removed emoji scripts** — saves ~16KB on every page load
- **Cleaned `<head>` output** — stripped `wp_generator`, `rsd_link`, `wlwmanifest_link`, etc.
- **Font preconnect** in header.php to warm up DNS/TLS before request
- **Cache-busting** via `filemtime()` in dev mode, version constant in production
- **Progressive enhancement** for animated counters — render correct values even if JS fails
Result: **PageSpeed 96 desktop, 85+ mobile** with Core Web Vitals all green (TBT 0ms, CLS 0).
---
## Setup (if you want to run it locally)
### Requirements
- WordPress 6.0+
- PHP 8.0+
- Advanced Custom Fields plugin (free version is enough)
### Install
1. Copy the theme folder to `/wp-content/themes/`
2. Install & activate Advanced Custom Fields
3. Activate this theme — CPTs and default categories are seeded automatically
4. **Settings → Reading** → set "Your homepage displays" to your preference
5. Visit **Portfolio Settings** in the admin sidebar to configure hero copy and contact info
6. Add projects, testimonials, FAQ items via their respective admin menus
### Recommended Plugins
- Advanced Custom Fields (required)
- Rank Math SEO (or Yoast)
- WP Mail SMTP (reliable email delivery)
- A caching plugin (WP Rocket, LiteSpeed, etc.)
---
## Theme System
Light/dark theme controlled by `[data-theme="dark"|"light"]` on `<html>`. Toggle button is in the nav. State persists in `localStorage` (key: `asad-portfolio-theme`). First-visit default respects `prefers-color-scheme`, falls back to dark.
CSS variables organize into a shared accent system + per-theme tokens. Adding a new theme is a matter of adding a `[data-theme="newtheme"]` block.
---
## Decisions Worth Calling Out
A few choices in this theme that I'd defend in a code review:
1. **No build step.** Plain CSS, plain JS. Senior WordPress devs know that adding webpack/vite to a theme for a single-page site is over-engineering. If the theme needed React components or TypeScript, the build cost would be justified. For this scope, it isn't.
2. **ACF fields in PHP, not the database.** Field group exports work, but PHP definitions live in git. When you deploy this theme to a new environment, fields just appear. No manual import step.
3. **Modular includes, thin functions.php.** Most theme `functions.php` files are 800+ lines of mixed concerns. Mine is 30 lines that loads focused module files. Each module has one job.
4. **Repeater fields replaced with flat individual fields** for tag chips. Repeaters are ACF Pro on some installations and have known rendering issues. Flat fields work everywhere, are easier to query, and are migration-safe.
5. **Progressive enhancement for counters.** Stat numbers render the target value as static HTML. JavaScript animates them when the user scrolls in — but if JS never loads, the numbers are still correct. Most portfolio themes show "0+" if JS fails. This one doesn't.
---
## License
[MIT](LICENSE) — use, fork, modify freely.
---
## Get in touch
- **Email:** [email protected]
- **WhatsApp:** +92 301 5651810
- **LinkedIn:** [in/asad-azam-518a5a236](https://linkedin.com/in/asad-azam-518a5a236/)
- **Portfolio:** [kreativehive.net/portfolio](https://kreativehive.net/portfolio/)
---
*Built by Asad Azam in Karachi, Pakistan. Open to senior WordPress full-time roles and select freelance WooCommerce projects.*
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

joshuatz-wp-theme
Custom Wordpress Theme for Portfolio Site
WordPress · 作品集

c2x
c2x is a simple WordPress PortFolio theme
WordPress · 作品集

Stratify-WP-Theme
Versatile agency and portfolio theme built for creative professionals and digital brands.
WordPress · 作品集

Block-Theme-Portfolio
Wordpress Block Themed Portfolio
WordPress · 作品集

nexgen-tech-wp-theme
A dark tech agency WordPress theme built with Tailwind CSS+GSAP animations
WordPress · 作品集

al-folio
al-folio 是一个面向学者与研究人员的 Jekyll 作品集主题,设计简洁、响应式,适合搭建个人学术主页。
Jekyll · 作品集
