Custom “Insert into Post” button

If you want it to show up in the image edit, say next to “insert into post” you will need to hook into attachment_fields_to_edit //for instance add_filter( ‘attachment_fields_to_edit’, ‘yourfunction’, 1, 2 ); Have a look at media.php http://mobile.adambrown.info/p/wp_hooks/hook/attachment_fields_to_edit?version=3.1&file=wp-admin/includes/media.php

WordPress Fancybox Resize Large Image

What you will need to do is edit your theme’s functions.php file to add a new image size. Scroll to the bottom and inside the php tags enter: add_image_size( ‘fancybox-full’, 800, 9999 ); This will create an uncropped image 800px wide, whenever an image is uploaded. You will then need to edit the anchor for … Read more

Remove attachment fields from custom media uploader

I know this isn’t an in depth answer (I’m at work and can’t really test any code) but, maybe you need to look at directly creating hooks for your upload – which should mean that the flash uploader will act as you expect. The hook for the flash loader is: pre-flash-upload-ui You can see where … Read more

Limit upload file type on one custom post type

I’m pretty sure $_REQUEST[‘post_id’] will hold the post ID you’re attaching uploads to. So something like this perhaps: if ( isset( $_REQUEST[‘post_id’] ) && $post_id = absint( $_REQUEST[‘post_id’] ) ) { switch ( get_post_type( $post_id ) ) { case ‘document’ : if ( ! in_array( $type, array( ‘pdf’, ‘msword’, ‘vnd.ms-excel’ ) ) ) $file[‘error’] = … Read more

Is it possible to upload text files (e.g. JSON) to wordpress blog in any way? [closed]

function upload_file($file_url) { if ( ! filter_var($file_url, FILTER_VALIDATE_URL) ) return false; $get = wp_remote_get( $file_url ); if ( ! is_wp_error( $get ) ) { // check mime type if you want // $mime_type = wp_remote_retrieve_header( $get, ‘content-type’ ); return wp_upload_bits( basename($file_url), ”, wp_remote_retrieve_body( $get ) ); } return false; } // use it like upload_file(‘http://www.site.com/path/myfile.json’); … Read more

WordPress uploads folder path. how it is decided?

When you uploaded an image within the Edit Page screen for a page with a date of 06/01/2013, the media uploader will use the date of the page to set the sub-directory within the uploads folder. This is expected behavior because the media uploader passes the post_date to the wp_upload_dir() function. See http://codex.wordpress.org/Function_Reference/wp_upload_dir#Important_Note If you … Read more

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