diff --git a/fields/acf-base.php b/fields/acf-base.php index 6f36a46..e629554 100644 --- a/fields/acf-base.php +++ b/fields/acf-base.php @@ -24,7 +24,9 @@ public function __construct() { parent::__construct(); // Hooks ! - add_action( 'save_post_attachment', array( $this, 'save_post_attachment' ) ); + add_action( 'add_attachment', array( $this, 'save_post_attachment' ) ); + add_action( 'edit_attachment', array( $this, 'save_post_attachment' ) ); + } /** @@ -272,21 +274,19 @@ public function display_svg() { return; } + echo ''; + echo '
'; foreach ( $files as $file ) { if ( ! is_file( $file['file'] ) ) { continue; } - + $svg = file_get_contents( $file['file'] ); - - if ( true === strpos( $svg, 'style="' ) ) { - $svg = str_replace( 'style="', 'style="display:none; ', $svg ); - } else { - $svg = str_replace( ''; + echo ''; } /**