yith_frontend_css_color_picker

Output a colour picker input box.

Description

yith_frontend_css_color_picker( (string) $name, (mixed) $id, (mixed) $value, (string) $desc = '' ); 

This function is not of the plugin YITH WCWL. It is from WooCommerce. We redeclare it only because it is needed in the tab Styles where it is not available. The original function name is woocommerce_frontend_css_colorpicker and it is declared in wp-content/plugins/woocommerce/admin/settings/settings-frontend-styles.php

Parameters (4)

0. $name (string)
The name.
1. $id (mixed)
The id.
2. $value (mixed)
The value.
3. $desc — Optional. (string) => ''
(default: '')

Usage

  1. if ( !function_exists( 'yith_frontend_css_color_picker' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-wishlist/includes/functions.yith-wcwl.php'; 
  3.  
  4. // The name. 
  5. $name = ''; 
  6.  
  7. // The id. 
  8. $id = null; 
  9.  
  10. // The value. 
  11. $value = null; 
  12.  
  13. // (default: '') 
  14. $desc = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = yith_frontend_css_color_picker($name, $id, $value, $desc); 
  18.  

Defined (1)

The function is defined in the following location(s).

/includes/functions.yith-wcwl.php  
  1. function yith_frontend_css_color_picker( $name, $id, $value, $desc = '' ) { 
  2. $value = ! empty( $value ) ? $value : '#ffffff'; 
  3.  
  4. echo '<div class="color_box"> 
  5. <table><tr><td> 
  6. <strong>' . $name . '</strong> 
  7. <input name="' . esc_attr( $id ). '" id="' . $id . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick colorpickpreview" style="background-color: ' . $value . '" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div> 
  8. </td></tr></table> 
  9. </div>'; 
  10.