定制 makewp/theme 二次开发

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

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

makewp/theme

最新稳定版本:0.2.0

Composer 安装命令:

composer require makewp/theme

包简介

Make WordPress themes, better.

README 文档

README

Make WordPress themes, better.

Usage

require_functions()

The goal is to code-split functions.php. Typically, functions.php contains anything and everything. But we want to be tidy. And we don't need a functions.php with lines and lines of requires when we can access the file system.

// {your-theme}/functions.php
<?php
require_once 'vendor/autoload.php';
\MakeWP\Theme\require_functions();
// {your-theme}/functions/test.php
<?php
echo 'functions/test.php';

You should now see "functions/test.php" in your browser.

Ok but wait but we shouldn't be accessing the file system with every page lo-

I mean, but like, cache, right?

register_blocks()

Same as require_functions(), but register_block_type()'s all directories inside.

// {your-theme}/functions.php
<?php
require_once 'vendor/autoload.php';
\MakeWP\Theme\register_blocks();
// {your-theme}/blocks/carousel/block.json
{
  "name": "carousel"
}

enqueue_style()

style.css is required for all WordPress themes, but isn't automatically enqueued as a stylesheet. Let's do that for us.

// {your-theme}/functions.php
<?php
require_once 'vendor/autoload.php';
\MakeWP\Theme\enqueue_style();

all()

Want to use all of the above? Don't want to call them all separately? I gotchu.

// {your-theme}/functions.php
<?php
require_once 'vendor/autoload.php';
\MakeWP\Theme\all();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-07