Access to Media Library
I’m not sure if this is exactly what you’re looking for, but you might want to check out: get_attached_media() and wp_get_attachment_url().
I’m not sure if this is exactly what you’re looking for, but you might want to check out: get_attached_media() and wp_get_attachment_url().
I’m not too familiar with Imagick, but if you can get a URL for the image you’ve created with it, then the rest is fairly straightforward using WordPress’s media_sideload_image() function. Here’s a basic example that would work from wp-admin area(like settings page). Note that it looks like you’d use your $id variable in place of … Read more
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’]; …
The OP had a .htaccess file in the uploads directory
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
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.
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
David Walsh has a php script that will zip files in an array. All that you would need to do is put all of the full size image src’s in an array and pass them to the script.
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
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’ );