Download the PHP package kuuak/wordpress-setting-fields without Composer
On this page you can find all versions of the php package kuuak/wordpress-setting-fields. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kuuak/wordpress-setting-fields
More information about kuuak/wordpress-setting-fields
Files in kuuak/wordpress-setting-fields
Package wordpress-setting-fields
Short Description WordPress setting field functions to output different type of fields
License MIT
Informations about the package wordpress-setting-fields
wordpress-setting-fields
WordPress setting field functions to output different type of fields.
Field Types Summary
Quick reference to all available field types:
- Text - Text input and textarea fields
- Dropdown - Select dropdown with custom options
- Switch (toggle) - Toggle/checkbox switch field
- Post type (dropdown) - Dropdown populated with posts of specified post types
- Taxonomy (dropdown) - Dropdown populated with taxonomy terms
- Pages (dropdown) - Dropdown populated with WordPress pages
- Button - Button field with action support
- Link (picker) - Link picker field using WordPress's built-in link modal
Field types
Text
Name: Kuuak\WordPressSettingFields\Fields::text
| Arguments: | name | type | mandatory | Description |
|---|---|---|---|---|
| type | string | false | Optional. HTML input type attribute or textarea. Default: text |
|
| id | string | false | Optional. Id attribute for the input. Default. the name argument | |
| name | string | true | Name of the input | |
| value | string | false | Optional. Current value of the input | |
| required | boolean | false | Optional. Whether the input is required. Default false | |
| placeholder | string | false | Optional. | |
| attrs | array | false | Optional. Extra html atrributes for the input. Attributes' name are the keys of the associative array. | |
| help | string | false | Optional. Help / description |
Example of usage
Dropdown
Name: Kuuak\WordPressSettingFields\Fields::dropdown
| Arguments: | name | type | mandatory | Description |
|---|---|---|---|---|
| id | string | false | Optional. Id attribute for the dropdown. Default. the name argument | |
| name | string | true | Name of the dropdown | |
| multiple | boolean | false | Optional. Define if multiple options can be selected in the list. | |
| selected | string | string[] | false | Optional. Selected value or values |
| required | boolean | false | Optional. Whether the dropdown is required. Default false | |
| show_option_all | string | false | Optional. Text to display for showing all items. Default empty. | |
| options | Array | true | Array of dropdown items. Items with keys value & title. |
|
| placeholder | string | false | ||
| help | string | false | Optional. Help / description. Default empty. | |
| echo | boolean | false | Optional. Whether to echo or return the generated markup. Default true. |
Example of usage
Switch (toggle)
Name: Kuuak\WordPressSettingFields\Fields::switch
| Arguments: | name | type | mandatory | Description |
|---|---|---|---|---|
| id | string | false | Optional. Id attribute for the input. Default. the name argument | |
| name | string | true | Name of the input | |
| checked | boolean | true | ||
| help | string | false | Optional. Help / description | |
| nice_ui | boolean | false | Optional. Display as a nicer ui. Default true. |
Example of usage
Post type (dropdown)
Name: Kuuak\WordPressSettingFields\Fields::post_type_dropdown
Arguments:
| name | type | mandatory | Description | |||
|---|---|---|---|---|---|---|
| query_args | array | false | WPQuery arguments. _See WPQuery::\_construct() for accepted arguments | |||
| name | string | true | Name of the dropdown | |||
| selected | int | string | int[] | string[] | false | Optional. Value of the option that should be selected. Default 0. |
| required | boolean | false | Optional. Whether the dropdown is required. Default false | |||
| placeholder | string | false | Optional. | |||
| show_option_all | string | false | Optional. Option all label for the Multiple version. Default All |
|||
| help | string | false | Optional. Help / description | |||
| echo | boolean | false | Optional. Either to print the dropdown or not. Default true. | |||
| nice_ui | boolean | false | Optional. Display as a nicer ui. Default true. | |||
| attrs | array | false | Optional. Extra html atrributes for the select input. Attributes' name are the keys of the associative array. |
Example of usage
Taxonomy (dropdown)
Name: Kuuak\WordPressSettingFields\Fields::taxonomy_dropdown
Arguments:
_See WP_TermQuery::__construct() for information on additional accepted arguments
| name | type | mandatory | Description | |||
|---|---|---|---|---|---|---|
| name | string | true | Name of the dropdown | |||
| taxonomy | string | true | Name of the taxonomy to | |||
| selected | int | string | int[] | string[] | false | Optional. Value of the option that should be selected. Default 0. |
| required | boolean | false | Optional. Whether the dropdown is required. Default false | |||
| show_option_all | string | false | Optional. Option all label for the Multiple version. Default All |
|||
| hide_empty | string | false | Optional. Option all label | |||
| help | string | false | Optional. Help / description | |||
| echo | boolean | false | Optional. Either to print the dropdown or not. Default true. |
Example of usage
Pages (dropdown)
Name: Kuuak\WordPressSettingFields\Fields::pages_dropdown
Arguments:
_See getpages() for additional arguments
| name | type | mandatory | Description | |
|---|---|---|---|---|
| name | string | true | Name of the dropdown | |
| selected | int | string | false | Optional. Value of the option that should be selected. Default 0. |
| required | boolean | false | Optional. Whether the dropdown is required. Default false | |
| help | string | false | Optional. Help / description. Default empty | |
| echo | boolean | false | Optional. Either to print the dropdown or not. Default true. |
Example of usage
Button
Name: Kuuak\WordPressSettingFields\Fields::button
Arguments:
| name | type | mandatory | Description |
|---|---|---|---|
| id | string | false | Optional. Id attribute for the button. Default. the name argument |
| name | string | true | Name of the button |
| label | string | true | Label of the button |
| variant | string | false | Optional. Variant of the button. primary or secondary. Default secondary |
| action | array | false | Action data |
| action.name | string | true | Action name |
| action.value | string | true | Action value |
| wrapper_attrs | array | false | Optional. Extra html atrributes for the wrapper. Attributes' name are the keys of the associative array. |
| help | string | false | Optional. Help / description. Default empty |
Example of usage
Link (picker)
Name: Kuuak\WordPressSettingFields\Fields::link
Renders a link field with WordPress's built-in link picker modal. Allows users to search for internal posts/pages or enter a custom URL. The field stores URL, link text, and target (for "open in new tab") values.
Arguments:
| name | type | mandatory | Description |
|---|---|---|---|
| id | string | false | Optional. Id attribute for the field. Default. the name argument |
| name | string | true | Name of the field. The field will create sub-fields: name[url], name[text], name[target] |
| value | array|string | false | Optional. Current value. Can be a string (URL only) or an array with keys: url, text, target. Default empty array |
| required | boolean | false | Optional. Whether the URL input is required. Default false |
| help | string | false | Optional. Help / description. Default empty |
Example of usage
Note: When saving the form, the field will submit as an array with
url,text, andtargetkeys. Thetargetvalue will be_blankif "open in new tab" is checked, or empty string otherwise.
Changelog
See CHANGELOG.md for a list of changes and version history.
Release Process
For release instructions, see the .cursor/rules/release-process.mdc file. This file contains a cursor rule that can be optionally used to guide the release process.