Skip Navigation

[Resolved] Toolset colorpicker CF is not using WP color pallete configuration.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 4 replies, has 3 voices.

Last updated by martenti 3 weeks, 3 days ago.

Assigned support staff: Luo Yang.

Author
Posts
#1683753

When picking up the color in colorpicker custom field, Toolset shows only the standard WP pallete mode: hidden link
I configured standard editor color picker with Central Color Pallete Plugin: hidden link and in other Toolset fields it shows according to settings: hidden link but in colorpicker field (the most important place!) not, just the default.

Is there any documentation that you are following?
https://wordpress.org/plugins/kt-tinymce-color-grid

Is there a similar example that we can see?
https://wordpress.org/plugins/kt-tinymce-color-grid

#1684649

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

I've checked the plugin page for "Central Color Palette" and it doesn't list Toolset in the list of supported plugins & themes.
( ref: https://wordpress.org/plugins/kt-tinymce-color-grid/ )

You can get in touch with the plugin's author to recommend extending its support for Toolset Type's "color picker" custom field.

For now, a workaround can be to replace "colorpicker" type custom field with a regular "single line" type custom field and then initialize WordPress's default color picker for this field, using some custom script.

Example: Suppose that you have a single line type custom field with slug "post-simple-field".

You can include a custom script file in the admin area, using some custom code in the active theme's "functions.php" file:


add_action( 'admin_enqueue_scripts', 'include_custom_color_picker_script' );
function include_custom_color_picker_script( $hook ) {
 
    if( is_admin() ) { 
     
        // Add the color picker css file       
        wp_enqueue_style( 'wp-color-picker' ); 
         
        // Include a custom jQuery file with WordPress Color Picker dependency
        wp_enqueue_script( 'custom-color-picker-script-handle', get_stylesheet_directory_uri().'/js/custom-script.js', array( 'wp-color-picker' ), false, true ); 
    }
}

Next, you'll add a folder named "js" in your active theme's folder and in this folder add a file named "custom-script.js" with the following code:


(function( $ ) {
 
    $(function() {
        $('input[name="wpcf[post-simple-field]"]').wpColorPicker();
    });
     
})( jQuery );

As a result, this single line type field will use WordPress's default color picker and the "Central Color Palette" plugin's palette option will be available.
( ref: hidden link )

I hope this helps and for more personalized assistance around custom code, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#1691471

Sorry Waqar, but this is not the solution anyway. This is exactly the opposite what you promise to customers. ‘Build wonderful websites without coding’, as I recall. Why should I put any additional php and js code to do such simple thing like using the standard WordPress palette? Even if I tried to use this code, this is totally inconvenient way, based on php, css, and JS – even worst then in ACF.

And also this is not the problem of any plugin incompatibility with Toolset, this is the problem of Toolset incompatibility with WordPress itself.

1. Why every other Toolset configured custom field, when dealing with colors is showing the standard WordPress color picker but in colorpicker custom field Toolset is NOT showing the standard worpress colorpicker?? This is incomprehensible for me. Is there any explicable reason behind this?

And your proposed code is the evidence of this. This is hacking Toolset inside Toolset. The code you propose me is doing exactly what I said above. It is forcing Toolset to use standard WP request. Why we should do this? This should be the Toolset standard behavior – use the WP core and WP standards, not any custom picker.

And there is more:
2. Why colorpicker field is not having the default value, like most of other custom fields? It has only placeholder. Is there any explicable reason behind this? Even the simple oneline custom field has a default value. Setting the color default value is necessary! How do you imagine setting the same color for lets say 50K products? And what about changing them?

And there is even more:
1. Why the proper set and saved default value from Toolset single line custom field is not accessible from Elementor dynamic tag? In this case the default value (and also your proposed workaround) is simply useless. This is also very strange, but it may be on the Elementor side.

Please do not try to find out the other ‘code based, toolset hacking solution’ for above problems. Please forward this ticket directly to Toolset code developers – and hey guys, please simply call the standard wp color picker in every toolset custom field. I assume this is a simpler approach. And finally, maybe I don’t understand something, or I am quite wrong in what I’m trying to archive, so then please explain me. I can live without these features, it can be done in different way, with other plugins, but I did not expected it would be impossible with Toolset.

Anyway, Toolset is of course a wonderful plugin/system and it working great in most of the contexts you show! Thanks for this.

Best Regards, stay safe,
Eryk

#1692503

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

Waqar is on vacation, I will take care this thread.

Thanks for the inputs.

1) The custom Colorpicker field is only one of custom fields from Toolset Types plugin, it is using WordPress built-in UI to display Colorpicker:
https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/

And you are right, there are some missing feature in it:
- Pre-made Color Palette
- Default value

If you agree, we can escalate as a feature request, our developers will evaluate it.

For the new question:

Why the proper set and saved default value from Toolset single line custom field is not accessible from Elementor dynamic tag?

Please check the new thread here:
https://toolset.com/forums/topic/why-the-proper-set-and-saved-default-value-from-toolset-single-line-custom-field-is-not-accessible-from-elementor-dynamic-tag/

#1705069

Additional palletes for WP Iris (as shown here by authors: hidden link) would be very good extension to colorpicker (dealing with colors is so common task), also the default value for colorpicker field would be good step (acf has it). I vote for this features - If it's possible please forward this request to developers for consideration. Thanx for now, we can close this ticket.