offbeatwp/acf-sitesettings
最新稳定版本:1.2.1
Composer 安装命令:
composer require offbeatwp/acf-sitesettings
包简介
Use ACF for OffbeatWP's site settings
README 文档
README
Install by running this command from the root of your OffbeatWP Theme:
composer require offbeatwp/acf-sitesettings
Next add the following line to your config/services.php file:
OffbeatWP\AcfSiteSettings\Service::class,
Adding a page
A page is an subpage with settings.
You can register a page by injecting the SiteSetting contract to your service and run the addPage method, like:
<?php namespace OffbeatWP\Services; use OffbeatWP\Contracts\SiteSettings; class ServiceScripts extends AbstractService { protected $settings; public function register(SiteSettings $settings) { $settings->addPage(\OffbeatWP\SiteSettings\SettingsScripts::class); } }
The addPage method accepts a class. A Settings class looks like this:
<?php namespace OffbeatWP\SiteSettings; class SettingsScripts { const ID = 'scripts'; const PRIORITY = 90; public function title() { return __('Scripts', 'raow'); } public function form() { $form = new \OffbeatWP\Form\Form(); $form ->addField(\OffbeatWP\Form\Fields\TextArea::make('scripts_head', 'Head')); $form ->addField(\OffbeatWP\Form\Fields\TextArea::make('scripts_open_body', 'Body open')); $form ->addField(\OffbeatWP\Form\Fields\TextArea::make('scripts_footer', 'Footer')); return $form; } }
Read more about Forms
统计信息
- 总下载量: 13.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-27