ID ); $form_fields['imagify'] = array( 'label' => 'Imagify', 'input' => 'html', 'html' => get_imagify_media_column_content( $attachment ), 'show_in_edit' => true, 'show_in_modal' => true, ); return $form_fields; } /** * Add "Compare Original VS Optimized" link to the media row action * * @since 1.4.3 * @author Geoffrey Crofte */ add_filter( 'media_row_actions', '_imagify_add_actions_to_media_list_row', PHP_INT_MAX, 2 ); function _imagify_add_actions_to_media_list_row( $actions, $post ) { // if this attachment is not an image, do nothing if ( ! wp_attachment_is_image( $post->ID ) ) { return $actions; } $attachment = new Imagify_Attachment(); // if Imagify license not valid, or image is not optimized, do nothing if ( ! imagify_valid_key() || ! $attachment->is_optimized() ) { return $actions; } // if was not activated for that image, do nothing if ( '' === $attachment->get_backup_url() ) { return $actions; } $image = wp_get_attachment_image_src( $post->ID, 'full' ); // if full image is too small if ( (int) $image[1] < 360 ) { return $actions; } // else, add action link for comparison (JS triggered) $actions['imagify-compare'] = '' . esc_html__('Compare Original VS Optimized', 'imagify') . ''; return $actions; }