Articles of backbone

i'm trying to get all my media query attachments via ajax in wordpress

i’m trying to load all my media files via ajax: $.ajax({ url: ‘/wp-admin/admin-ajax.php’, type: ‘post’, data: { ‘action’: ‘query-attachments’, ‘post_id’: 0, ‘query[orderby]’: ‘date’, ‘query[order]’: ‘DESC’, ‘query[posts_per_page]’: -1, ‘query[paged]’: 1 }, }); as you can see i’m trying to get ALL my media files: ‘query[posts_per_page]’: -1, in my template, i’m trying to get and display all […]

How to Dequeue All WordPress Assets

I want to dequeue all styles and scripts that are loaded on the front-end (EG. not the admin panel) by default. I found this function, but am not sure how to utilize it to accomplish my goal. I’m seeing a ton of assets that I don’t need on the front end, loaded by WP core: […]

Am I able to change the name of /wp-admin/options-general.php?

I’m asking this question because I am coding a WordPress plugin, and I want to be able to detect when WP-Admin is using options-general.php. Currently, I’m just checking the URL directly to see if it ends with options-general.php, but if WordPress allows installations to change the filenames of this file, then my plugin may not […]

Minimum version for WordPress Backbone

How do I find the minimum WordPress version required if I want to use Backbone on a plugin? I’m building a WordPress plugin, and I can’t find documentation online that records when WordPress first used Backbone.

Is there a media_upload_tabs-similar filter to add tabs to the simple/featured image picker?

There’s something I have been wondering about the media_upload_tabs filter that lets you create new image insert sections to the add-media modal in WordPress editor inserter. Oddly enough it seems it still does nothing at all to add anything to the simple image picker (eg. the featured image picker). Take the Nextgen photo gallery photo […]

Mapping Backbone Models to serialized array in wp_options table

I want to create a to do list to use Backbone in the context of WordPress, and i want to save models as single serialized array via update_option(), the problem is that i don’t know how to mappe the models to this array so i can use model.fetch(id) and model.destroy(id). MyTodo.TodoModel = Backbone.Model.extend({ defaults: { […]

Add guid filter to attachment in media library grid mode

I’m trying to show in media modal box, attachments from a specific folder in my website and, correct me if I’m wrong, the best way to proceed is a like filter on wp_posts field GUID. Something like and ({$wpdb->posts}.guid LIKE ‘%/uploads_media_news/%’)). Problem is I don’t really know where to apply this filter: is it better […]

How to submit data between wp_iframe and backbone.js in media upload

In short: On a post/page edit.php I want to be able to click Add media and open the default media uploader instead of Create Gallery on the left-side menu there is a custom tab. on this custom tab the user can choose/select custom stuff (e.g.: a custom setting). the user clicks a button (like Create […]

How to retrieve a value from an input field in a media view template

I’ve created a media view template with two input fields (width and height) and I was wondering how to retrieve the values entered in them in a media controller o view. PHP: function add_my_media_view_template(){ ?> <script type=”text/html” id=”tmpl-my-media-view”> <label class=”setting width”> <span><?php _e(‘Width’); ?></span> <input type=”text” class=”alignment” data-setting=”width” /> </label> <label class=”setting height”> <span><?php _e(‘Height’); […]

Backbone.js and WP API

I’m creating a theme based on the underscore theme with Backbone.js integration. I am struggling to find any clear examples/documentation on the WP-API plugin’s capabilities, and starting to find it fairly frustrating. I am pulling in a basic list of posts using the following code: var posts = new wp.api.collections.Posts(), posts.fetch(options).done(function(){ console.log( ‘we now have […]