How to echo JS right after enqueued script to put it into noConflict mode?

You have to filter script_loader_src, check if you are on the correct script and add a one-time filter for clean_url. Then add your extra script, and make sure the output is syntactically valid. Pretty simple, albeit rather hacky. class Extra_Script { private $extra = []; private $handle; private $url; private $versioned_url; public function __construct( $handle, … Read more

Is it possible to enqueue the Youtube API script or does it have to be inline?

First, make sure the YT api is enqueued() and added to the footer. function wp_enqueue_scripts__youtube_api() { wp_enqueue_script( ‘yt-player-api’, ‘http://www.youtube.com/player_api’, array(), false, true ); } add_action( ‘wp_enqueue_scripts’, ‘wp_enqueue_scripts__youtube_api’ ); Next, output your div somewhere on the page. <div id=”‘ . $postid . ‘player”></div> Then, hook into wp_footer and make sure you set the priority higher that … Read more

WordPress Rest API

What version of the REST API are you using? If you’re using the version that’s bundled with WordPress 4.4 (ie, v2), you’ll need to change your url to something like http://example.com/wp-json/wp/v2/posts. Reference WP API version 2 docs

Show control conditionally in Gutenberg

There are 2 main issues in your code: What is that restrict in your OptionsPanel component? Where and how you defined it? Both the onUpdateRestrict and onUpdateSubscribe are not functions, so clicking on the toggle controls will result in a JavaScript error. And if you can show your complete code, I can probably help you … Read more

What does wp-list.js do?

This file is for list manipulations with jQuery: add, delete or dim list items. It was introduced in Ticket #4805 to replace some prototype code. Attached to the ticket is a sample plugin which holds the actual documentation. It doesn’t work really good … line 461 should be: $id = isset ( $_POST[‘id’] ) ? … Read more

Extend core block in Gutenberg

Not a real answer alert This sounds like a long term bad idea. You are modifying a core functionality with something which do not inherit any of the generated markup of the original block. Any later processing of the block might make assumption about the markup based on the block name, but the assumptions might … Read more