Use the backbone.js client to save custom post type meta
Use the backbone.js client to save custom post type meta
Use the backbone.js client to save custom post type meta
Media Library Grid View Custom Filter
After digging through the media modal code, I came up with the answer to my question: wp.media.controller.Custom = wp.media.controller.State.extend({ initialize: function(){ this.props = new Backbone.Model(); }, // called when the toolbar button is clicked customAction: function( controller ){ // get the value of a media view template form field using // this.props.get(‘key’), where ‘key’ is … Read more
if (wp.media) { wp.media.view.AttachmentCompat.prototype.on(“ready”, function (e) { console.log(“Kompat Ready mokor 12″); }); } This event name is “ready” 🙂 works now fine . Maybe this will help someone.
fetch returns a promise, so you want to wait until the promise is resolved. For example: new wp.api.models.Post( { id: 1 } ).fetch().then( console.log ); or doing something with the data: new wp.api.models.Post( { id: 1 } ).fetch().then( post => { console.log( post ); } ); To address your comment, Promises are async – so … Read more
As of 4.1.1, the nonce is defined in wp-includes/media.php, line 2883: $settings[‘post’] = array( ‘id’ => $post->ID, ‘nonce’ => wp_create_nonce( ‘update-post_’ . $post->ID ), ); So to verify the nonce: wp_verify_nonce( $nonce, “update-post_$post_ID” );
I haven’t used the WP-API/JSON REST client plugin so far, but this is what I can see in source: The ~/js/models.js is the entry point for all requests, it seems. And every of the wp.api.models (to name a few: Page, Post, Media, Revision, etc.) is just an extension of Backbone.Model. And looking into the actual … Read more
I’m not sure what more you need that the example there, and remember that some scripts are needed for stuff like the admin bar and are not enqueued if you are not logged in. function wpdocs_dequeue_script() { wp_dequeue_script( ‘jquery-ui-core’ ); } add_action( ‘wp_print_scripts’, ‘wpdocs_dequeue_script’, 100 ); This will dequeue the jquery-ui-core js. Adding more lines … Read more
Excerpt from the documentation: (scroll down to the “Working With Revisions” section on that page) Note: Because the schema is stored in the user’s session cache to avoid re-fetching, you may need to open a new tab to get a new read of the Schema. So it’s probably just a caching issue and you only … Read more
Pros and cons of using Backbone for WordPress theming [closed]