Tag Info

New answers tagged

0

Maybe I was over thinking, but the solution is easier than I thought. I just have to limit the event handler to some element, so other unrelated ones will not trigger the handler. In this case, .media-modal is the overall parent of the media library element, so I am specifying this extra selector to the event, like below: ...


0

This is what I've found which I use regularly. Really it's the same thing you're using but placing it into the admin footer so that it's one of the last things to load. Maybe it's faster? function media_library_filter(){ ?> <script type="text/javascript"> jQuery(document).on("DOMNodeInserted", function(){ ...


0

i deactivated all the plugins and reactivated them back again, just to find out than one of those was currupted / outdated. now everything works fine again.


0

You can do something like this in your functions file. add_image_size( 'category-thumb', 300 ); // 300 pixels wide (and unlimited height) add_image_size( 'homepage-thumb', 220, 180, true ); // (cropped) Then you can do something like this to give your custom size a certain name in the Admin area. add_filter( 'image_size_names_choose', ...


0

This has something to do with the HTML of a media object. I copy/pasted code from another image imported from the media gallery and it worked. Use this function to insert the content: http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.setContent tinyMCE.activeEditor.setContent('<span>some</span> html');


2

In your handler, if you set 'error', the error message will be displayed and will cancel the upload add_filter('wp_handle_upload_prefilter', 'custom_upload_filter' ); function custom_upload_filter( $file ){ $image_info = getimagesize($file['tmp_name']); $image_width = $image_info[0]; $image_height = $image_info[1]; if($image_with != 800 ...


1

If I am understanding the question correctly, you should be able to do a query for the media by user id. Something like the follow (untested) code: //only do this if there is a user logged in if( is_user_logged_in() ) { //get the currenly logged in user $user_ID = get_current_user_id(); $upload_args = array( 'post_type' => ...


0

For trivia WP will generate all registered sizes for every image natively. While this doesn't quite seem optimal, the recommendation (if one might call it that) to deal with it is "get bigger disks". :) If size isn't a concern you can just go with it. The typical solution takes a little different angle. Instead of generating specific sizes on upload, the ...


0

A hacky way to do it is to do a string replace on the tmpl-attachment-details template: // See wp_print_media_templates() in "wp-includes/media-template.php" function wpse157297_print_media_templates() { $my_link = '<a class="my_link-attachment" href="my_link.php?url={{ data.url }}" target="_blank">' . __( 'My Link' ) . '</a>'; $nonimage ...


0

I figured it out myself so I will post the answer here, please note that the original answer can also be found on StackOverflow. If the mods feel like this should be deleted from here and only remain, please go ahead. I thought it might be useful on both places. First the correct code, then an explaination: // Here we add a new user role, "cliente". ...


0

Here's a heinous hack that replaces the title of uploaded images with the url (constructed by chopping the "-150x150" affix from the pinkynail): function wpse156087_admin_footer_media_new_php() { ?> <script type="text/javascript"> jQuery(document).ready(function() { (function ($) { uploader.bind('UploadComplete', function() { ...



Top 50 recent answers are included