Using wp_editor in TinyMCE WindowManager dialog
Using wp_editor in TinyMCE WindowManager dialog
Using wp_editor in TinyMCE WindowManager dialog
Is it mandatory to enqueue any kind of Javsacript? Nothing is mandatory, but it is good practice. And since WordPress 4.5 it’s actually quite simple. Is it better to save this string (some variables contain jQuery calls) to a file and enqueue? There is no need to write a temporary file just so you can … Read more
This is because you are using wp_kses_post to sanitize the output data, try without it: <?php echo get_theme_mod( ‘script-code’); ?> also remove it from here: $wp_customize->add_setting ( ‘script-code’, array ( ‘default’ => esc_html__( ‘Script Code’, ‘x’ ), ‘sanitize_callback’ => ” // remove wp_kses_post ) ); also make sure you are using the right name of … Read more
Sending custom data with Media Frame Model
Adding scripts directly to the content is not a good idea. You can disable escaping of content, but that is even a worse idea. Here we have a couple of solutions. Using a plugin The PHP Code Widget allows you to add almost anything as a widget. If you have some text widgets, you can … Read more
Remove type attribute from script added by wp_localize_script
You are getting this error because your edit and save function output doesn’t match. save({attributes}) { return ( <button class=”usa-button”> { attributes.text } </button> ); } precisely, { attributes.text } is the save function is not being called or used in edit function. Either add attributes.text in edit function or remove that from save function. … Read more
with jquery in footer.php jQuery(document).ready(function($){ $(‘.wpcft-form-control div.checkbox’).addClass(‘col-4’); } or via css (you will have to adjust for various screen resolution and make some test) <style> .wpcft-form-control div.checkbox{width:33%;max-width:33%;float:left} </style> But I think you can create separate n separate checkboxes and wrap them in a <div class=”col-4″>[checkbox checkbox-x “option1″]</div> <div class=”col-4”>[checkbox checkbox-x “option2″]</div> <div class=”col-4”>[checkbox checkbox-x “option3”]</div> … Read more
How to check if customize previewer is refreshing?
I ended up putting an empty svg in an img tag with an onload event. This is probably not ideal, but it does work. <img // onload hack fires when block is added className=”onload-hack-pp” height=”0″ width=”0″ onLoad={ onBlockLoad } src=”data:image/svg+xml,%3Csvg xmlns=”http://www.w3.org/2000/svg” viewBox=’0 0 1 1′ %3E%3Cpath d=”/%3E%3C/svg%3E” />