I am trying to create a custom field (text/CSS code in textarea) that include the CSS suggestion like Additional CSS in the customizer:
https://i.postimg.cc/9QhLPgVk/image.png.
Does everybody has experience with that?
I need any solution like the above screenshot here: https://i.postimg.cc/L55cpChD/image.png.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
As it happens, I was literally just doing some stuff with the customizer.
You can use the following class to get what you need..
WP_Customize_Code_Editor_Control
I’ll include it in the control ready to go.
$wp_customize->add_control( new WP_Customize_Code_Editor_Control( $wp_customize, 'favorite_html', array(
'label' => 'Theme CSS',
'description' => '',
'code_type' => 'text/css',
'section' => 'section_id',
'settings' => 'settings_control'
)));
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0