Download the PHP package proteusthemes/wp-customizer-utilities without Composer
On this page you can find all versions of the php package proteusthemes/wp-customizer-utilities. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download proteusthemes/wp-customizer-utilities
More information about proteusthemes/wp-customizer-utilities
Files in proteusthemes/wp-customizer-utilities
Package wp-customizer-utilities
Short Description Advanced WordPress customizer controls and settings for better user experience.
License GPL-2.0+
Informations about the package wp-customizer-utilities
WP Customizer Utilities
Advanced WordPress customizer controls and settings for better user experience.
Requirements
Requires PHP version 7.2.0 or greater.
Installation
Install it via Composer and Packagist:
Start using the classes and they will be autoloaded (PSR-4).
Documentation
Controls
-
Layout Builder
jQuery UI slider with an option how many handles you want to control in that slider. Useful for creating dynamic layouts, for example for the footer, where user can congigure how many columns they want and how wide each of these columns will be.
-
Gradient
Control for the CSS gradient (WP has only support for solid colors by default).
Settings
-
Dynamic CSS
Create Dynamic CSS by declaring the selectors (for example for background colors etc.) when defining a setting. Has build-in support for modifiers of that color and media queries.
Public methods
get_css_props()
Get entire css_props property of the class.
get_single_css_prop( string $name, DynamicCSS\ModInterface|callable $modifier )
Return all variants of the CSS propery with selectors. Optionally filtered with the modifier.
render_css()
Render the entire CSS for this setting in the inline style (each group of selectors in its own line). Useful for caching the output of the setting and echoing it on the WP frontend.
Modifier Interface
ModInterface
The modifer classes must implement the
DynamicCSS\ModInterface
. It has only one methodmodify( $in )
which takes input value and returns the modified value.Example:
Included modifiers
Some modifiers are already included with the package and you can use them stright away.
ModDarken( $amount )
- darken hexdec color for$amount
(using phpColors)ModLighten( $amount )
- lighten hexdec color for$amount
(using phpColors)ModLinearGradient( ModInterface $modifier, $orientation = 'to bottom' )
- creates CSS linear-gradient. First color is instact, second color is modified using$modifier
.$orientation
can be any valid CSS orientation.ModPrependAppend( $prefix = '', $suffix = '' )
- adds the prefix or suffix (or both) to the value. Useful for adding!import
orurl('value')
.
Use
Example of the code you would most likely attach to the action
customize_register
:You must also enqueue the JS file which handles the live preview changes via
postMessage
: