Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mejta committed Oct 25, 2024
1 parent 63f5091 commit db71f1a
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 13 deletions.
1 change: 1 addition & 0 deletions assets/styles/components/field-multi-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
display: flex;
flex-flow: column;
gap: var(--wpifycf-gap-2);
user-select: none;
}

&__item {
Expand Down
1 change: 1 addition & 0 deletions assets/styles/components/field-multi-post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
display: flex;
flex-flow: row wrap;
gap: var(--wpifycf-gap-1);
user-select: none;
}

.wpifycf-post-preview {
Expand Down
1 change: 1 addition & 0 deletions assets/styles/components/field-multi-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
flex-flow: row wrap;
gap: var(--wpifycf-gap-1);
margin-bottom: var(--wpifycf-gap-1);
user-select: none;
}

&__option {
Expand Down
1 change: 1 addition & 0 deletions assets/styles/components/multi-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
flex-flow: column;
max-width: 60em;
gap: var(--wpifycf-gap-1);
user-select: none;
}

.wpifycf-multi-field-item {
Expand Down
2 changes: 1 addition & 1 deletion build/wpify-custom-fields-rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/wpify-custom-fields.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-primitives', 'wp-server-side-render', 'wp-url'), 'version' => '55d8d4d53b65263e901a');
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-primitives', 'wp-server-side-render', 'wp-url'), 'version' => '982933421b6e7c4cb5ad');
2 changes: 1 addition & 1 deletion build/wpify-custom-fields.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/wpify-custom-fields.js

Large diffs are not rendered by default.

Binary file added docs/images/integration-comment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions docs/integrations/comment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Comments Metabox

Comments metabox integrates custom fields into comment edit screen:

Example URL: `/wp-admin/comment.php?action=editcomment&c=1`

## Preview

![Integration of custom fields into comment metabox.](../images/integration-comment.png)

## Example

```php
wpify_custom_fields()->create_comment_metabox(
array(
'id' => 'example_comment_metabox',
'title' => 'Example Comment Metabox',
'items' => array( /* fields definitions */ ),
/* other arguments */
),
);
```

## Arguments

#### `$id` *string*

Meta box ID (used in the 'id' attribute for the meta box).

#### `$title` *string*

Title of the meta box.

#### `$callback_args` *array*

Data that should be set as the `$args` property of the box array (which is the second parameter passed to your
callback).

#### `$meta_key` *string*

Meta key used to store the custom fields values. If meta key is empty, the individual fields will be stored as separate
meta.

#### `$tabs` *array*

Tabs used for the custom fields.

#### `$items` *array*

List of the fields to be shown.
46 changes: 46 additions & 0 deletions docs/integrations/metabox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Metabox

## Example

```php
wpify_custom_fields()->create_metabox(
array(
'id' => 'example_metabox',
'title' => 'Example Metabox',
'items' => array( /* fields definitions */ ),
/* other arguments */
),
);
```

## Arguments

#### `$id` *string*

Meta box ID (used in the 'id' attribute for the meta box).

#### `$title` *string*

Title of the meta box.

#### `$priority` *string*

The priority within the context where the box should show.
You can use constants:

```php
\Wpify\CustomFields\Integrations\Comment::PRIORITY_HIGH = 'high'
\Wpify\CustomFields\Integrations\Comment::PRIORITY_CORE = 'core'
\Wpify\CustomFields\Integrations\Comment::PRIORITY_LOW = 'low'
\Wpify\CustomFields\Integrations\Comment::PRIORITY_DEFAULT = 'default'
```

#### `$callback_args` *array*

Data that should be set as the `$args` property of the box array (which is the second parameter passed to your
callback).

#### `$meta_key` *string*

Meta key used to store the custom fields values. If meta key is empty, the individual fields will be stored as separate
meta.
32 changes: 23 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# WPify Custom Fields

WPify Custom Fields is a powerful, developer-oriented WordPress library for creating custom fields. This library offers maximum flexibility for developers to integrate custom fields into various parts of WordPress, ranging from post metaboxes to WooCommerce product options. Built with React.js and requiring no additional composer dependencies, it is designed to be highly extendable and future-proof.
WPify Custom Fields is a powerful, developer-oriented WordPress library for creating custom fields. This library offers
maximum flexibility for developers to integrate custom fields into various parts of WordPress, ranging from post
metaboxes to WooCommerce product options. Built with React.js and requiring no additional composer dependencies, it is
designed to be highly extendable and future-proof.

## Features

- **Developer-Oriented**: WPify Custom Fields provides maximum control for developers who need flexibility in their WordPress projects.
- **Developer-Oriented**: WPify Custom Fields provides maximum control for developers who need flexibility in their
WordPress projects.
- **Composer Support**: Easily integrate WPify Custom Fields into your project with Composer:
```composer require wpify/custom-fields@next```
- **Broad Integration**: Custom fields can be implemented in a wide variety of locations, including but not limited to:
Expand All @@ -23,9 +27,12 @@ WPify Custom Fields is a powerful, developer-oriented WordPress library for crea
- User Options
- Woo Membership Plan Options
- WooCommerce Settings
- **50+ Field Types**: A wide range of field types is available, allowing you to build anything from simple input fields to complex multi-attachment galleries.
- **Highly Expandable**: WPify Custom Fields is designed to be easily extended. You can create new custom field types and add them to custom implementations.
- **Conditional Logic**: Show or hide fields conditionally based on the current data, giving you more control over the display and functionality of your custom fields.
- **50+ Field Types**: A wide range of field types is available, allowing you to build anything from simple input fields
to complex multi-attachment galleries.
- **Highly Expandable**: WPify Custom Fields is designed to be easily extended. You can create new custom field types
and add them to custom implementations.
- **Conditional Logic**: Show or hide fields conditionally based on the current data, giving you more control over the
display and functionality of your custom fields.
- **Tabbed Field Organization**: Organize your custom fields into tabs for better user experience and cleaner UI.
- **Required Fields**: Make fields required to ensure important data is captured.
- **React.js Powered**: Built using React.js for a modern and dynamic user interface.
Expand Down Expand Up @@ -63,6 +70,7 @@ wpify_custom_fields()->create_metabox(
### Installation

1. Install via Composer:

```bash
composer require wpify/custom-fields@next
```
Expand All @@ -71,11 +79,17 @@ composer require wpify/custom-fields@next

## Why WPify Custom Fields?

- **Flexibility**: WPify Custom Fields integrates with multiple parts of WordPress and WooCommerce, offering flexibility that surpasses most other custom field plugins.
- **Ease of Use**: While developer-focused, the library is designed to be straightforward, allowing you to implement custom fields with minimal code.
- **Extendable**: With the ability to create custom field types and implementations, you are never limited by the built-in features.
- **Flexibility**: WPify Custom Fields integrates with multiple parts of WordPress and WooCommerce, offering flexibility
that surpasses most other custom field plugins.
- **Ease of Use**: While developer-focused, the library is designed to be straightforward, allowing you to implement
custom fields with minimal code.
- **Extendable**: With the ability to create custom field types and implementations, you are never limited by the
built-in features.
- **Future-Proof**: Built with React.js and PHP 8.1+, WPify Custom Fields is ready for modern WordPress development.

## Documentation & Support

For full documentation, examples, and advanced usage, please visit the [WPify Custom Fields documentation](https://github.com/wpify/custom-fields/tree/next/docs). If you encounter any issues or have questions, feel free to [open an issue](https://github.com/wpify/custom-fields/issues) on GitHub or reach out for support.
For full documentation, examples, and advanced usage, please visit
the [WPify Custom Fields documentation](docs/index.md). If you encounter any
issues or have questions, feel free to [open an issue](https://github.com/wpify/custom-fields/issues) on GitHub or reach
out for support.

0 comments on commit db71f1a

Please sign in to comment.