getolympus/olympus-dionysos-field-wordpress 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

getolympus/olympus-dionysos-field-wordpress

Composer 安装命令:

composer require getolympus/olympus-dionysos-field-wordpress

包简介

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

README 文档

README

Dionysos Wordpress Field

Olympus Component CodeFactor Grade Packagist Version MIT

This component is a part of the Olympus Dionysos fields for WordPress. It uses a duplicate findPosts WordPress custom modal to manage field.

composer require getolympus/olympus-dionysos-field-wordpress

Table of contents

Field initializationVariables definitionsTexts definitionAccepted typesRetrive dataRelease historyContributing

Field initialization

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

return \GetOlympus\Dionysos\Field\Wordpress::build('my_wordpress_field_id', [
    'title'       => 'Which is your favourite post?',
    'default'     => [],
    'description' => 'Tell us which one did like this week.',
    'field'       => 'ID',
    'multiple'    => false,
    'type'        => 'post',
    'settings'    => [],

    /**
     * Texts definition
     * @see the `Texts definition` section below
     */
    't_addblock_title' => 'Click on the edit button',
    't_addblock_description' => 'Click on the "+" button to add your item.',
    't_addblocks_description' => 'Click on the "+" button to add a new item.',
    't_addblock_label' => 'Add',
    't_editblock_label' => 'Edit',
    't_removeblock_label' => 'Remove',

    't_modaltitle_label' => 'Choose a content',
    't_modalclose_label' => 'Close',
    't_modalsearch_label' => 'Search',
    't_modalsubmit_label' => 'Select',

    't_ajaxerror_label' => 'No item found',
]);

Variables definitions

Variable Type Default value if not set Accepted values
title String 'Code' empty
default Array empty empty
description String empty empty
field String ID depends on type value
multiple Boolean false true or false
type String post see Accepted types
settings Array empty depends on type value

Notes:

  • Set multiple to true to display checkboxes instead of radio buttons
  • field variable is used to let you retrieve the data you need, depending on type value (for example: in the 'type' => 'term' case, you'll get term_id by default)

Texts definition

Code Default value Definition
t_addblock_title Click on the edit button Used as a notice to help users when there is no label yet
t_addblock_description Click on the "+" button to add your item. Used as a notice to help users in single format
t_addblocks_description Click on the "+" button to add a new item. Used as a notice to help users in multiple format
t_addblock_label Add Add button label
t_editblock_label Edit Edit button label
t_removeblock_label Remove Remove button label
t_modaltitle_label Choose a content Modal title
t_modalclose_label Close Modal close button label
t_modalsearch_label Search Modal search button label
t_modalsubmit_label Select Modal select button label
t_ajaxerror_label No item found Error message on ajax failure

Accepted types

Retrive data

Retrieve your value from Database with a simple get_option('my_wordpress_field_id', []) (see WordPress reference):

// Get wordpress from Database
$wordpress = get_option('my_wordpress_field_id', []);

if (!empty($wordpress)) {
    echo '<ul>';

    foreach ($wordpress as $post_id) {
        echo '<li>'.get_the_title($post_id).'</li>';
    }

    echo '</ul>';
}

Release history

Version Note
0.0.21 Add checks on ajax call
0.0.20 Add wp-util WordPress integration
0.0.19 Fix display and WordPress core functions integration

Contributing

  1. Fork it (https://github.com/GetOlympus/olympus-dionysos-field-wordpress/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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固