定制 tjm/wp-base-theme 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tjm/wp-base-theme

Composer 安装命令:

composer require tjm/wp-base-theme

包简介

WordPress theme to use as parent theme for easy theme development

README 文档

README

This is a WordPress theme very much meant to be used as a base for building another theme. It comes almost completely unstyled. It has templates with widget and nav locations to cover most situations, and class name hooks to handle most style situations, so you could go pretty far just editing styles. It uses my WPThemeHelper project and other niceties to help make development easier.

WPThemeHelper

This helps abstract away some of the boring or repetetive tasks common to developing a WordPress theme. For instance, I use its SettingHelper to set most theme settings with a simple JSON file (settings.json). I use it's buffer management / template rendering functionality to help keep template output organized and DRY.

Skeleton

I like to have my site "skeleton" (header and footer in WordPress parlance) to be in one file. I find this makes it easier to see what is going on and to maintain. To do this, I capture the "main" page content (ie what the stuff between get_header() and get_footer() or get_sidebar()) in an output buffer, then stick it in the middle of a skeleton file (skeleton.html.php). I maintain compatibility with the get_header() and get_footer() functions by having the former start an output buffer and the latter ends it and then renders the skeleton template.

I also like to be able to load my content in a JSON wrapper instead of the full HTML wrapper. This is useful for if you use the history API to handle page changes, pulling content via AJAX and sticking it into the "main" area without having to do a full page refresh. To this end, I have set up a switch to load "skeleton.json.php" instead of the HTML version if the request is via AJAX.

Template Pieces

With the Renderer of WPThemeHelper, I can render reusable bits of code from the pieces folder. Unlike get_template_part(), I can pass data into these templates. This also allows me to easily load template files in the callback functions used for the bits of markup used by theme features such as the custom header and custom background. I've seen other themes put this markup directly in the callback functions, making them difficult to find, look at, modify, and maintain.

General

I tried keep things organized and DRY. I use a fairly minimal number of the basic WordPress templates with conditions to handle minor differences. The theme is set up to be used as a parent theme. It is easy to override any of the templates, including things rendered with the Renderer. I use composer to work with dependencies that are maintained separately (namely WPThemeHelper).

Usage

Clone this theme project and put it in your theme folder. Run bin/composer install to get dependencies in place. Then you can activate this theme and modify to your hearts content. Or, more ideally, you can create a child theme and override whatever you need to. To do so, you would put the line 'Template: tjmbase' in the comments at the top of your child theme's 'style.css'. To modify the settings that go to WPThemeHelper, you can create a $tjmThemeHelper array in your 'functions.php' file. This array will be passed to the constructor of WPThemeHelper.

tjm/wp-base-theme 适用场景与选型建议

tjm/wp-base-theme 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tjm/wp-base-theme 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tjm/wp-base-theme 我们能提供哪些服务?
定制开发 / 二次开发

基于 tjm/wp-base-theme 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-06-15