3.5 media manager add CSS / JS to new ‘tab’ iframe content

You need to en-queue your styles and scripts in your media upload hook and then clal wp_iframe function. Just do it like this and it will work: <?php add_filter( ‘media_upload_tabs’, ‘olab_add_media_tab’ ); function olab_add_media_tab( $tabs ) { $tabs[‘bildarkiv’] = __( ‘Bildarkiv’, ‘bildarkiv’ ); return $tabs; } add_action( ‘media_upload_bildarkiv’, ‘olab_tab_iframe’ ); function olab_tab_iframe() { wp_register_style( ‘bak-css’, … Read more

Max file size not updating

1] To do this, change the upload_max_filesize and post_max_size directives in your php.ini file. To ensure that file uploads work correctly, the post_max_size directive should be a little larger than the upload_max_filesize. For example, the following settings demonstrate how to set a file upload limit to 20 megabytes: upload_max_filesize = 20M post_max_size = 21M 2] … Read more

Looking to display non-image files in Gallery with logo specific to file type

WordPress has a native function wp_mime_type_icon() in wp-includes/post.php that you can use. Basic example: // $attachment should be a full post object if ( wp_attachment_is_image( $attachment->ID ) ) { echo wp_get_attachment_image( $attachment->ID, array( 480, 900 ), FALSE, array ( ‘class’ => ‘aligncenter’ ) ); } else { echo ‘<img src=”‘ . wp_mime_type_icon( $attachment->post_mime_type ) . … Read more

media_handle_upload weird thing

Look into the first lines of this function: function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrides = array( ‘test_form’ => false ) ) { $time = current_time(‘mysql’); if ( $post = get_post($post_id) ) { if ( substr( $post->post_date, 0, 4 ) > 0 ) $time = $post->post_date; } $name = $_FILES[$file_id][‘name’]; $file = wp_handle_upload($_FILES[$file_id], $overrides, … Read more

Upload images with comment

EDIT: With some help of a friend I came up with a solution. For everyone interested: Use a custom post-type, in my case comment_post. Then upload the images like this: $new_post = array( ‘post_title’ => $title, ‘post_content’ => $comment, ‘post_status’ => ‘pending’,// Choose: publish, preview, future, draft, etc. ‘post_type’ => ‘comments_post’ // Use a custom … Read more

resize images not crop

Custom Image Sizes Resizing without cropping is already part of the core functionality, via add_image_size(). Note the last parameter: <?php add_image_size( $name, $width, $height, $crop ); ?> The Codex entry describes the $crop parameter as follows: $crop (boolean) (optional) Crop the image or not. False – Soft proportional crop mode ; True – Hard crop … Read more

How can I stop WP media uploader from creating duplicates of my uploaded images?

I believe the following should stop thumbnails from being created. If you’re wanting to remove some then and unset the $size[{size}]. Following sizes are there “thumbnail”,”medium”,”large”,”post-thumbnail”. add_filter(‘intermediate_image_sizes_advanced’,’stop_thumbs’); function stop_thumbs($sizes){ return array(); }

How to Check Disk Space used by Media Library

Using this StackOverflow Answer, I came up with a Dashboard Widget that displays the following: I extended the OP request for the uploads dir size (default or custom location) and added wp-content (default or custom), blogs.dir case in Multisite, and WordPress base dir. <?php /* Plugin Name: Folder Sizes Dashboard Widget Plugin URI: http://wordpress.stackexchange.com/q/67876/12615 Description: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)