Unattaching unlinked images

wordpress sucks in keeping media<=>content relationships. Part of the problem is that by default all media are public once they are uploaded and you have no way to know where are they are being used. Just because an image is not referenced anymore in its original post doesn’t mean that it is not referenced at … Read more

Is is possible to crop an image after uploading

Untested, but I believe this should work: jQuery(document).ready(function (){ jQuery(“.select-image”).click(function() { var custom_uploader = wp.media({ title: ‘Selecteer een afbeelding’, button: { text: ‘Selecteer’ }, multiple: false }); custom_uploader.on(‘select’, function() { custom_uploader.Jcrop(); }); custom_uploader.open(); }); });

How to protect uploads in multisite if user is not logged in?

Nice Question! Poking around it a little bit, this seems to be working (further tests and a more qualified look are much welcome:). Tested only in a localhost development install with subdomains. No domain mapping. Change the following .htaccess rewrite rule: # uploaded files # RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] RewriteRule ^files/(.+) dl-files.php?file=$1 [L] Make a … Read more

wp_editor with media buttons

You can use following code to achieve this if ( is_user_logged_in() ) { // Editor without media buttons wp_editor( $content, ‘editorname’, array(‘media_buttons’ => false) ); } else { // Editor with media buttons wp_editor( $content, ‘editorname’); }

How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS

Yes, it’s possible in the same manner as before. I don’t know why you think the filter is not passing the parameters anymore. add_filter(‘attachment_fields_to_edit’, ‘user16975_edit_fields’, 10, 2); function user16975_edit_fields($form_fields, $attachment){ // check for an audio attachment if ( substr($attachment->post_mime_type, 0, 5) == ‘audio’ ) { $playertag = $playertag = “”; $form_fields[“audioplayer”] = array( “label” => … Read more

Replacing all attachment links in post with media file link

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.

Slow wp_enqueue_media()

To load admin scripts only on your pages, you should use the $hook-parameter: function enqueue_scripts( $hook ) { if( ‘my-page’ != $hook ) return; wp_enqueue_script(‘jquery’); wp_enqueue_media(); // etc… } add_action(‘admin_enqueue_scripts’, ‘enqueue_scripts’); Concerning the loading problem. This seems to be still an open problem. The ticket 27985 was followed up by #32264, which is not closed … Read more

Attach Files Metabox

For the part of opening a lightbox, browse for something and then performing something on an action within: WordPress has this already build in. For what you ask is basically the thickbox that opens up like in the post editor when you browse for an image in the gallery. You find all the code you … Read more

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