定制 getolympus/olympus-dionysos-field-font 二次开发

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

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

getolympus/olympus-dionysos-field-font

Composer 安装命令:

composer require getolympus/olympus-dionysos-field-font

包简介

Font field, this component is a part of the Olympus Dionysos fields.

README 文档

README

This component is a part of the Olympus Dionysos fields for WordPress.

composer require getolympus/olympus-dionysos-field-font

Olympus Component CodeFactor Grade Packagist Version MIT

Field initialization

Use the following lines to add an font field in your WordPress admin pages or custom post type meta fields:

return \GetOlympus\Dionysos\Field\Font::build('my_font_field_id', [
    'title'       => 'Select your character!',
    'default'     => [
        'family'         => 'Open Sans',
        'backup'         => 'Arial, Helvetica, sans-serif',
        'subset'         => 'latin',
        'variant'        => 'regular',
        'size'           => '16px',
        'lineheight'     => '1.8',
        'letterspacing'  => '0',
        'color'          => '#000000',
    ],
    'description' => 'Select your fighting stage!',
]);

Variables definition

Variable Type Default value if not set Accepted values
title String 'Font' empty
default Array empty empty
description String empty empty

Retrive data

Retrieve your value from Database with a simple get_option('my_font_field_id', []) (see WordPress reference).
Below, a json_encode() example to understand how data are stored in Database:

{
  "family": "Open Sans",
  "backup": "Arial, Helvetica, sans-serif",
  "subset": "latin",
  "variant": "regular",
  "size": "16px",
  "lineheight": "1.8",
  "letterspacing": "0",
  "color": "#000000"
}

And below, a simple example to show how to iterate on the data array in PHP:

// Get font from Database
$font = get_option('my_font_field_id', []);

// Check if font is empty and display it
if (!empty($font)) {
    echo '<h1 style="font-family:'.$font['family'].';font-size:'.$font['size'].'">My custom title</h1>';
}

Release History

0.0.2

  • Add ajax call
  • Add display
  • Add Google fonts

0.0.1

  • Initial commit

Contributing

  1. Fork it (https://github.com/GetOlympus/olympus-dionysos-field-font/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Built with ♥ by Achraf Chouk ~ (c) since a long time.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固