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

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

get total number of images from media using xml-rpc

VERSION 1 will query all the images and give you a count by checking the size of the returned array. VERSION 2 is a much faster method introduced by birgire. // VERSION 1 $images = get_posts(array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘any’, ‘numberposts’ => -1, ‘fields’ => ‘ids’, ‘post_mime_type’ => ‘image/jpeg,image/gif,image/jpg,image/png’, )); echo count($images) . … Read more

Add custom image sizes to media uploader

Invalid argument supplied for foreach means that the X in foreach X as … is not an array. You can prevent this error by type casting; add (array) before the argument in the foreach statement. This will turn your variable into an array, essentially. In your code, the change would be… foreach ( (array) $attach_meta[‘sizes’] … Read more

Upload images using FTP and show them in media

I know it’s one year old but just in case someone else is also searching: You could upload the main files (not all 3 sizes, just the original images) via FTP to another directory on your server and then use the Add-From-Server Plugin.

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