How to add multiple checkbox elements to media attachments?

Like @Bainternet said, it is the same thing. Taking the code from the question you linked to, you can do it like this: function filter_attachment_fields_to_edit( $form_fields, $post ) { $foo = (bool)get_post_meta( $post->ID, ‘foo’, true ); $bar = (bool)get_post_meta( $post->ID, ‘bar’, true ); $form_fields[‘foo’] = array( ‘label’ => ‘Is Foo’, ‘input’ => ‘html’, ‘html’ => … Read more

Post Auto Draft Issue

You probably need to modify the columns displayed in your Custom Post posts list, so that the list isn’t dependent solely on Post Title. I have a similar situation, with a Custom Post Type that consists solely of a “featured image” (and a “link” custom metabox). I modified the Post list to output the image, … Read more

How to add attachment without uploading?

You need the local path to add an attachment: // add the file to the media library $attachment = array( ‘post_mime_type’ => ‘image/png’ // the MIME type , ‘post_title’ => ‘Attachment title’ ); // Adds the file to the media library and generates the thumbnails. $attach_id = wp_insert_attachment( $attachment, $path ); // PATH!

Getting ID from ajax response of async-upload.php

I could but i really don’t want to post the work of others here, even if it’s open source code. Rilwis Meta Box Class has a plupload field, which has a custom upload handler. If you mind to take a look: https://github.com/rilwis/meta-box resp: https://github.com/rilwis/meta-box/blob/master/inc/fields/plupload-image.php#L31 The answer is there. This code,or at least the idea, gives … Read more

Disable edit media attachments?

I figured it out. Just put this in your functions.php file add_action(‘admin_head-media-upload-popup’, ‘remove_edit_image_button’); // for the pop up media box add_action(‘admin_head’, ‘remove_edit_image_button’); // for the media page function remove_edit_image_button() { ?> <style> .A1B1 p .button { display:none; } </style> <?php }

Adding class to next/prev image link in attachment.php

There two hooks to filter these links: previous_image_link and next_image_link. So we can add these classes per filter: add_filter( ‘previous_image_link’, ‘wpse_77296_img_link_class’ ); add_filter( ‘next_image_link’, ‘wpse_77296_img_link_class’ ); /** * Add CSS class to image navigation links. * * @wp-hook previous_image_link * @wp-hook next_image_link * @param string $link Complete markup * @return string */ function wpse_77296_img_link_class( $link … Read more

Insert custom ID into wp_get_attachment_link

You have to supply a argument count when adding the filter callback, and add the arguments you are expecting to receive to your callback function. Looking at the wp_get_attachment_link source you can tell that 6 arguments is supplied when applying the filters (the link markup and $id, $size, $permalink, $icon, $text). Here’s how you could … Read more

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