public function __construct($item) { global $wf; parent::__construct($item); $id = $this->id(); $file_url = wp_get_attachment_url( $id ); $file_path = WOOF_File::infer_content_path($file_url); if (wp_attachment_is_image( $id ) ) { $c = $wf->get_image_class(); $this->file = new $c( $file_path, $file_url ); } else { $c = $wf->get_file_class(); $this->file = new $c( $file_path, $file_url ); } }