Use custom image size in admin panel
Image sizes are hard-coded throughout WordPress core; Tom’s comment to adjust the dimensions of the built-in image sizes is the best approach.
Image sizes are hard-coded throughout WordPress core; Tom’s comment to adjust the dimensions of the built-in image sizes is the best approach.
Figured out the answer to the question. file_frame.on(‘open’, function() { var selection = file_frame.state().get(‘selection’); var library = file_frame.state(‘gallery-edit’).get(‘library’); var ids = jQuery(‘#fg_perm_metadata’).val(); if (ids) { idsArray = ids.split(‘,’); idsArray.forEach(function(id) { attachment = wp.media.attachment(id); attachment.fetch(); selection.add( attachment ? [ attachment ] : [] ); }); file_frame.setState(‘gallery-edit’); idsArray.forEach(function(id) { attachment = wp.media.attachment(id); attachment.fetch(); library.add( attachment ? [ … Read more
I just ran into this. The reason is that you are overriding the window.send_to_editor function with one of your own. WordPress uses this function to insert galleries and other stuff, so now that you’ve changed it, it can’t. Ideally’ you’d want to use an event triggered by the media uploader instead of just replacing the … Read more
Try removing (function($){ from the beginning and })(jQuery); from the end. And change jQuery(document).ready(function() to jQuery(document).ready(function($)
I guess you copied that code from somewhere. Just from reading through it, I don’t see wppf_gallery_ids set anywhere aside from the init function, which means that it can’t update anything as the check is empty. I see two options: Either update it during selection within the select function, or just push wppf_new_ids into the … Read more
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
You can inspire from this tutorial here: http://www.sitepoint.com/adding-a-media-button-to-the-content-editor/ For videos you can change the library type to ‘video’: function open_media_window() { var window = wp.media({ title: ‘Insert a media’, library: {type: ‘video’}, multiple: false, button: {text: ‘Insert’} }); } Hope this helps.
Ok, It’s been so long since I posted this question I totally forgot about it. I finally used popup.on( ‘open’, function() {…}); to remove left modal sidebar. Here we go: popup.on( ‘open’, function() { jQuery( ‘.media-frame-menu’ ).remove(); jQuery( ‘.media-frame-router, .media-frame-title, .media-frame-content, .media-frame-toolbar’ ).css({‘left’: 0}); }); That’s it 🙂 EDIT I managed to hide right hand … Read more
If you remove that conditional in the first line of the enqueue function, your scripts should load. I can’t see the broader context of why your function is written that way, but if you just copied it from a tutorial or something, you don’t need it here. Try: <?php function sunset_load_admin_scripts(){ wp_enqueue_media(); wp_register_script(‘sunset-admin-script’,get_template_directory_uri() .’/js/news_admin.js’, array(‘jquery’), … Read more
If you’ve hardcoded the youtube video’s in your markup then one solution would be adding ?autoplay=1 to the src url. For example: src=”https://www.youtube.com/embed/i8GZwagNZss?autoplay=1″ Let me know if you need further help.