Post Specific Uploader

Check if the argument is present, and if it isn’t return the default value: if(!isset($_REQUEST[‘post_id’])) return $upload; // cast it to integer to avoid problems $id = (int)$_REQUEST[‘post_id’]; …

Creating a Lightweight Media Tags Plugin with a Custom Taxonomy

Sadly, I haven’t found the flaw in your code as far as update counts. Copy and paste mine for comparison (stick it in a plugin you can easily deactivate). This works like a charm, with all counts updating correctly: class ZGAttachmentTags { const SLUG = ‘attachment-tags’; function __construct() { add_action( ‘init’, array( $this, ‘register_custom_taxonomy’ ) … Read more

Run script after clicking Set Featured Image in Media

I think what you need is (function(){ var featuredImage = wp.media.featuredImage.frame(); featuredImage.on(‘select’, function(){ var attachment = featuredImage.state().get(‘selection’).first().toJSON(); console.log(attachment); }); })(); The attachment object should have height and width properties.

Media gallery – inserting full size images without link

UPDATE I’ve just submitted a core patch to add link=”none” support to the shortcode. ORIGINAL ANSWER You don’t need to hack core to do what you want to do; just use the appropriate shortcode parameters, e.g.: If you want to change the defaults, then use the post_gallery filter: function mytheme_gallery_shortcode_defaults( $output, $attr ) { global … Read more

Add/change multipart_params parameter when uploading post image

To send a customer data to the server, do the following customFileFrame.uploader.options.uploader.params.yourCustomProperty = ‘yourCustomValue’; Where: yourCustomProperty – parameter name yourCustomValue – parameter value processing data from the server add_action(‘add_attachment’, array($this, ‘addAttachmentParama’)); public function addAttachmentParama($post_id){ if (isset($_REQUEST[‘yourCustomProperty’]) && isset($_REQUEST[‘action’]) && ‘upload-attachment’ == $_REQUEST[‘action’]) { update_post_meta($post_id, ‘yourCustomProperty’, $_REQUEST[‘yourCustomProperty’]); } } Mini Plugin for example <?php /* Plugin … Read more

Image size filtering in Media uploader according to custom post type

Add following code in your themes functions.php file function theme_set_default_image_size() { global $post_type; $custom_image_size=”medium”; if($post_type == ‘news’) $custom_image_size=”news_image_size”; else if($post_type == ‘product’) $custom_image_size=”product_image_size”; else if($post_type == ‘service’) $custom_image_size=”service_image_size”; return $custom_image_size; } add_filter( ‘pre_option_image_default_size’, ‘theme_set_default_image_size’ );

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