getolympus / olympus-dionysos-field-color
颜色字段,该组件是Olympus Dionysos字段的一部分。
v0.0.13
2020-03-22 15:14 UTC
Requires (Dev)
- phpunit/phpunit: ~5.3
README
该组件是 WordPress 的 Olympus Dionysos字段 的一部分。
它使用默认的WordPress颜色字段。
composer require getolympus/olympus-dionysos-field-color
字段初始化
使用以下代码在您的 WordPress 管理页面或自定义文章类型元字段中添加一个 颜色字段
return \GetOlympus\Dionysos\Field\Color::build('my_color_field_id', [ 'title' => 'What is your favorite Coke?', 'default' => '#f40000', 'description' => 'Zero and Light are not available colors!', /** * Color picker settings * @see https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/lib/color-picker.js */ 'settings' => [ 'defaultColor' => false, 'hide' => true, 'palettes' => true, 'width' => 255, 'mode' => 'hsv', 'type' => 'full', 'slider' => 'horizontal', ], ]);
变量定义
检索数据
使用简单的 get_option('my_color_field_id', '')
从数据库中检索您的值(参见 WordPress参考)。
// Get color from Database $color = get_option('my_color_field_id', '#f40000'); // Display Coca-Cola baseline in color echo 'Always <b style="color:'.$color.'">Coca-Cola</b>';
发布历史
0.0.13
- 使用默认的
getVars
Zeus-Core方法。不再需要覆盖它。
0.0.12
- 新Olympus组件兼容性
- 更改存储库以成为Dionysos字段的一部分
0.0.11
- 修复:twig源文件中的json编码器
贡献
- 将其分叉(https://github.com/GetOlympus/olympus-dionysos-field-color/fork)
- 创建您的功能分支(
git checkout -b feature/fooBar
) - 提交您的更改(
git commit -am 'Add some fooBar'
) - 将更改推送到分支(
git push origin feature/fooBar
) - 创建一个新的Pull Request
由Achraf Chouk用♥构建 Achraf Chouk ~ (c) 很久以来。