Loading different JS for http and https
If you link to the JS file just using something like //examplesite.com/js/jsfile.js without the http:// or https:// the browser should automatically get the correct http or https version
If you link to the JS file just using something like //examplesite.com/js/jsfile.js without the http:// or https:// the browser should automatically get the correct http or https version
Yes, this can be done. Are you using MediaUpload? Once an image is selected, MediaUpload returns that image object, which includes sizes: full, large, medium etc – this will include any custom sizes you’ve defined. Then, instead of assigned the url to the attribute, you save the url of the size you want. This is … Read more
Updated for TinyMCE 4 I’ve made some progress Load a wp_editor in the initial page load in a hidden div, then do the AJAX call to grab the editor markup. While in PHP, you will need to retrieve the IDs of the editors created via wp_editor calls. Unfortunately, the variables on the _WP_Editors class are … Read more
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
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
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
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
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
yes, WordPress has a function for loading javascript files: http://codex.wordpress.org/Function_Reference/wp_enqueue_script the last argument takes either true or false to load in the footer
If you’re just using a small script or other markup, you can hook a function to the wp_footer filter, which should be included in all properly-coded themes: add_action( ‘wp_footer’, function () { ?> <script language=”javascript” type=”text/javascript”> startcart() </script> <?php } ); However, if your JavaScript code is more substantial, or you wish to use built-in … Read more