项目作者: soderlind

项目描述 :
WordPress Customizer Range Value Control is a generic range with value control you can use to replace the default range control.
高级语言: CSS
项目地址: git://github.com/soderlind/class-customizer-range-value-control.git


WordPress Customizer Range Value Control

A generic range with value control you can use to replace the range control.

Demo

I’ve added this control to my customizer demo theme.

Installing the control

Add the following to your composer.json file and run composer update

  1. "require": {
  2. "soderlind/class-customizer-range-value-control": "dev-master"
  3. },
  4. "extra": {
  5. "installer-paths": {
  6. "inc/{$name}": [
  7. "soderlind/class-customizer-range-value-control"
  8. ]
  9. }
  10. }

If you want to install into the vendor folder, use

  1. "require": {
  2. "soderlind/class-customizer-toggle-control": "dev-master"
  3. },
  4. "extra": {
  5. "installer-paths": {
  6. "vendor/soderlind/{$name}": [
  7. "soderlind/class-customizer-range-value-control"
  8. ]
  9. }
  10. }

or, clone the repo into inc

Include the class

  1. /**
  2. * Check for WP_Customizer_Control existence before adding custom control because WP_Customize_Control
  3. * is loaded on customizer page only
  4. *
  5. * @see _wp_customize_include()
  6. */
  7. if ( class_exists( 'WP_Customize_Control' ) ) {
  8. require_once dirname( __FILE__ ) . '/inc/class-customizer-range-value-control/class-customizer-range-value-control.php';
  9. }

Adding the control

  1. $wp_customize->add_control( new Customizer_Range_Value_Control( $wp_customize, 'my_control', array(
  2. 'type' => 'range-value',
  3. 'section' => 'my_section',
  4. 'settings' => 'my_settings',
  5. 'label' => __( 'Width' ),
  6. 'input_attrs' => array(
  7. 'min' => 1,
  8. 'max' => 240,
  9. 'step' => 1,
  10. 'suffix' => 'px', //optional suffix
  11. ),
  12. ) ) );

Credits

The CSS and JavaScript is copyright (c) 2016 by Sean Stopnik

You can see his demo at CodePen.io

The CSS and JavaScript is licensed under the terms of the MIT license

WordPress Customizer Range Value Control is copyright 2016 Per Soderlind

WordPress Customizer Range Value Control is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

WordPress Customizer Range Value Control is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Extension. If not, see http://www.gnu.org/licenses/.