FYI hack của tôi cho liên kết xem trước (trước 4.0):
Sau khi liên kết tải xuống trong tplsingle.php, tôi đã chèn đoạn mã sau:
<?php if ($this->file->remote_url == false): ?>
<a href="/<?php echo $this->file->viewerlink ?>" class="openlink wpfdlightbox wpfd_previewlink" data-id="<?php echo $this->file->ID; ?>" data-catid="<?php echo $this->file->catid; ?>" data-file-type="<?php echo $this->file->ext; ?>" >
<img src="http://yoursite.com/wp-content/plugins/wp-file-download/app/site/assets/images/theme/preview.png"></a>
<?php endif; ?>
Và sau đó trong theme .php, hãy thêm các dòng sau vào danh sách các tập lệnh của hàm showFile ():
wp_enqueue_style('wpfd-colorbox', plugins_url( 'app/site/assets/css/colorbox.css' , WPFD_PLUGIN_FILE ),array(),WPFD_VERSION);
wp_enqueue_style('wpfd-viewer', plugins_url( 'app/site/assets/css/viewer.css' , WPFD_PLUGIN_FILE ),array(),WPFD_VERSION);
wp_enqueue_script('wpfd-colorboxjs', plugins_url( 'app/site/assets/js/jquery.colorbox-min.js' , WPFD_PLUGIN_FILE ),array(),WPFD_VERSION);
wp_enqueue_script('wpfd-colorbox-init', plugins_url( 'app/site/assets/js/colorbox.init.js' , WPFD_PLUGIN_FILE ),array(),WPFD_VERSION);
wp_localize_script('wpfd-colorbox-init','wpfdcolorbox',array('ajaxurl' => Application::getInstance('wpfd')->getAjaxUrl()));