Documentation for IDE’s

One possible solution is to make the WordPress source code available to the IDE by adding it’s path to the project. IntelliJ reads the Javascript functions available. This is not a pretty solution though (I’d like someone to be able to load the project on their machine and have this work).

Refused to execute script from ‘***’ because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled

The error is most likely correct (and is most likely related to browser upgrade than any WP version change) and your theme/plugin does fishy things. The ajax enedpoint should be uses to return data – html/json/xml. WordPress will use the text/html mime type for all responses from the ajax endpoint without any simple way I … Read more

WP Customizer set a value via javascript (to create presets)

The solution is to simply enqueue the JS value syncing snippet so that it is added in the customizer pane (customize.php) instead of the customizer preview window (on the frontend). In other words, enqueue your JS at customize_controls_enqueue_scripts instead of wp_enqueue_scripts. Here’s one snippet: wp.customize( ‘field1’, ‘field2’, function( field1, field2 ) { field1.bind( function( value … Read more

WordPress customizer: load controls in a custom div

Put below codes in your functions.php function sorcey_customize_register($wp_customize){ $wp_customize->add_section(‘sorcey_footer’, array( ‘title’ => __(‘New Section’, ‘text_domain’), ‘description’ => ”, ‘priority’ => 120, )); /* ============================= Text input ===============================*/ $wp_customize->add_setting(“sr_copyright”, array( “default” => “”, ‘capability’ => ‘edit_theme_options’, “transport” => “postMessage”, )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, “sr_copyright_ctrl”, array( “label” => __(“Title”, “text_domain”), “section” => “sorcey_footer”, “settings” => “sr_copyright”, “type” => … Read more

How execute shortcode with javascript

to execute “ShortCode” which server side-> wordpress ->php ,by JavaScript which client side you will need use AJAX! you can use some thing like: 1-in your enqueued .js file : jQuery(document).ready(function($) { $(‘.buttonClass’).on(‘click’, function() { $.ajax({ url: Param.doShortCode, type: ‘POST’, data: { action: ‘handle_ajax_shortcode’, }, success: function() { //do something on success }, error: function() … Read more