Tag Info

New answers tagged

1

I'm able to do the following in media modal: var selection = wp.media.frame.state().get('selection'); // get selected collection attachment = wp.media.attachment(id); // get attachment with id attachment.fetch(); selection.add(attachment); // add attachment to selection collection There should be .remove() method ...


0

I found nothing better than: // switch to attachment browser wp.media.frame.content.mode('browse'); // refresh attachment collection wp.media.frame.content.view.views._views[".media-frame-content"][0].views._views[""][1].collection.props.set({ignore:(+(new Date()))}); Feel free to add proper way of doing this.


1

I found a nice snippet at this site for your functions.php that does the trick: add_shortcode( 'gallery', 'file_gallery_shortcode' ); function file_gallery_shortcode( $atts ) { $atts['link'] = 'file'; return gallery_shortcode( $atts ); } I'd actually been looking unsuccessfully for the same thing, so I'm glad you asked.


0

get_attached_file() can do this, given you know attachment ID for input.


1

0 should work as a height in your thumbnail settings. The only other issue is that your uploaded images might be smaller than the large media size you're inputting. Image thumbs won't be scaled up for obvious reasons. If your images are larger than your thumbnail setting and you're still not seeing thumbnails generated then: Check your server logs Try ...


0

You should set your height to 9999 in order to keep aspect ratio


0

I believe the following is happening here: As @Luke pointed out, wp_insert_attachment() takes an array of post data. The format of the array you are passing to it is not correct. The keys are different. What should be stored as the post_mime_type, is being passed with the key type. Because of this, no mime type is being saved for the post. ...


0

Found the answer: $categories = get_terms( 'category', array('hide_empty' => false) );


0

This one is much easier to add on the functions.php and works like charm : function hide_media_by_other($query) { global $pagenow; if( 'upload.php' != $pagenow || !$query->is_admin ){ return $query; } if( !current_user_can( 'manage_options' ) ) { global $user_ID; $query->set('author', $user_ID ); } return $query; } ...


1

Try removing (function($){ from the beginning and })(jQuery); from the end. And change jQuery(document).ready(function() to jQuery(document).ready(function($)


0

Milo got me on the right track. If anyone else happens to have this issue the code I used is: /** * Redirect broken attachment links to 404 */ function ww_404_broken_links(){ global $wp_query; if(is_attachment()){ $attachment_path = get_attached_file( get_the_ID() ); //If the file doesn't exist on the server show 404 ...


0

I think the best plug in to solve this problem is Media File Manager Advanced. I let you check the description of it at: http://wordpress.org/plugins/media-file-manager-advanced/


0

media_handle_sideload handles the uploads in the same way the normal upload does. That means, when you upload a remote image (YouTube thumbnails in your case) it will automatically create the thumbnails of sizes registered using add_image_size. So, what you need to do is create a thumbnail of desired size and call it in your loop. function my_setup() { ...


0

I have this same issue (can upload fine, but not insert into post). It appears that for me I'm changing the location of my wp-content folder by using a combination of these config values: define('WP_CONTENT_FOLDERNAME', 'media'); define('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME ); define('WP_CONTENT_URL', 'http://domain.com'.WP_CONTENT_FOLDERNAME); ...



Top 50 recent answers are included