2017 © Pedro Peláez
 

olympus-field olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Zeus Core framework.

image

getolympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Zeus Core framework.

  • Saturday, March 17, 2018
  • by crewstyle
  • Repository
  • 1 Watchers
  • 0 Stars
  • 180 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

, (*1)

Dionysos Wordpress Field

Olympus Component ![CodeFactor Grade][codefactor-image] Packagist Version ![MIT][license-image], (*2)

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

composer require getolympus/olympus-dionysos-field-wordpress

Table of contents

Field initializationVariables definitionsTexts definitionAccepted typesRetrive dataRelease historyContributing, (*4)


Field initialization

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

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), (*6)

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):, (*7)

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

if (!empty($wordpress)) {
    echo '

    '; foreach ($wordpress as $post_id) { echo '
  • '.get_the_title($post_id).'
  • '; } echo '
'; }

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., (*8)

The Versions

17/03 2018

dev-master

9999999-dev https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Zeus Core framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus zeus hera

17/03 2018

v0.0.9

0.0.9.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Zeus Core framework.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus zeus

15/08 2017

v0.0.8

0.0.8.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera

03/03 2017

v0.0.7

0.0.7.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera

08/10 2016

v0.0.6

0.0.6.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera

22/08 2016

v0.0.5

0.0.5.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera

26/06 2016

v0.0.4

0.0.4.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera

10/05 2016

v0.0.3

0.0.3.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera

05/05 2016

v0.0.2

0.0.2.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera

29/04 2016

v0.0.1

0.0.1.0 https://github.com/GetOlympus/olympus-wordpress-field

[READ-ONLY] Wordpress field, this component is a part of the Olympus Hera WordPress library.

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress framework php field olympus hera