Download the PHP package kevinpirnie/kpt-wpfieldframework without Composer

On this page you can find all versions of the php package kevinpirnie/kpt-wpfieldframework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kpt-wpfieldframework

KPT WP Field Framework

A PHP framework for creating WordPress Options Pages, Meta Boxes, and Gutenberg Blocks with repeatable field groups.

Requirements

Installation

Quick Start

In a Plugin

In a Theme

Options Pages

Basic Options Page

Tabbed Options Page

Tabbed options pages allow you to organize settings into multiple tabs. Each tab's settings are preserved when saving - only the current tab's fields are updated while other tabs' data remains intact.

Submenu Options Page

Retrieving Options

Meta Boxes

Post/Page Meta Box

Custom Post Type Meta Box

User Profile Meta Box

Nav Menu Item Meta Box

Retrieving Meta Values

Gutenberg Blocks

Creating a Block from a Meta Box

Custom Block Rendering

Block template file (blocks/testimonial.php):

Field Types

Text-Based Fields

Date/Time Fields

Selection Fields

Text Areas & Editors

Media Fields

Special Fields

Layout Fields

Conditional Fields

Fields can be shown or hidden based on the values of other fields in the same section. Conditionals are evaluated in real-time using JavaScript.

Single Condition

Multiple Conditions (AND)

All conditions must be true for the field to be visible.

Multiple Conditions (OR)

At least one condition must be true for the field to be visible.

Available Condition Operators

Operator Description
== Equal to
!= Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
IN Value is in array/comma-separated list
NOT_IN Value is not in array/comma-separated list
CONTAINS Value contains substring or array contains value
NOT_CONTAINS Value does not contain substring
EMPTY Value is empty
NOT_EMPTY Value is not empty

Conditional with Radio Buttons

Conditionals on Groups and Accordions

Groups and accordions fully support conditional logic. You can show/hide entire groups or accordions based on other field values.

Nested Conditionals (Inside Accordions/Groups)

When using conditionals on fields inside an accordion or group, the field IDs are automatically prefixed with the parent's ID. You must use the prefixed field ID when referencing sibling fields within the same parent.

For example, if you have an accordion with ID my_accordion containing a switch with ID enable_option, the actual field ID becomes my_accordion_enable_option. Any conditional referencing this field must use the full prefixed ID:

Important: When a conditional references a field outside the accordion/group (at the root level), use the original field ID without any prefix:

Repeater Fields

Basic Repeater

Repeater with Multiple Field Types

Retrieving Repeater Data

Field Groups

Basic Group

Inline Group Fields

Use the inline option to display fields side-by-side within a group:

Retrieving Group Data

Note: Group sub-field values are stored with the group ID as a prefix (e.g., address_street for a field with ID street inside a group with ID address).

Accordion Fields

Accordions provide a collapsible container for organizing related fields:

Field Configuration Options

All fields support these common options:

Option Type Description
id string Unique field identifier (required)
type string Field type (required)
label string Field label
sublabel string Secondary label displayed below the main label
description string Help text displayed below field
default mixed Default value
placeholder string Placeholder text
required bool Whether field is required
disabled bool Whether field is disabled
readonly bool Whether field is read-only
class string Additional CSS class(es)
inline bool Display field inline (for groups/repeaters)
attributes array Additional HTML attributes
sanitize callable Custom sanitization callback
validate callable Custom validation callback
conditional array Conditional display rules

Custom Sanitization

Custom Validation

Storage API

The Storage class provides a unified interface for all WordPress data storage:

Export / Import Settings

The framework includes built-in functionality to export and import settings, making it easy to backup configurations or migrate settings between environments.

Enabling Export/Import UI

Add show_export_import => true to your options page configuration:

This adds an "Export / Import Settings" panel at the bottom of your options page that allows users to:

Programmatic Export/Import

You can also export and import settings programmatically:

Export File Format

Exported JSON files include metadata and all settings:

Security Considerations

Advanced Usage

Manual Initialization

Requirements Check

The framework automatically checks requirements when using Loader::init(). If requirements are not met, an admin notice is displayed.

Without Composer Autoloader

JavaScript Events

The framework triggers custom jQuery events for extensibility:

Global JavaScript Object

The framework exposes a global KpWsfAdmin object:

Hooks & Filters

The framework integrates with standard WordPress hooks. Meta boxes use these hooks:

License

MIT License. See LICENSE file for details.

Author

Kevin Pirnie - [email protected]

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please open an issue on GitHub.


All versions of kpt-wpfieldframework with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kevinpirnie/kpt-wpfieldframework contains the following files

Loading the files please wait ...