JavaScript in WordPress Customizer

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

Gutenberg block “This block appears to have been modified externally” on save

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

Contact Form 7 – Give each checkbox a class?

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

Load script after block is inserted

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” />