Skip to main content
  Wednesday, April 12 2017
  2 Replies
  1.9K Visits
  Subscribe
Would like to have the option of adding an alias or display name field in the shortcode. For example, [wpfd_single_file id="111" name="Download Now"] rather than show the filename.

Also, would like to have a preview link appear on wpfd single files. I have already hacked the plugin to do this, but would make my life 1000x simpler if this functionality was out-of-the-box and I didn't have to modify the code after each update.

Thanks!
P
6 years ago
FYI my hack for preview link (pre-4.0):

After the download link in tplsingle.php, I inserted the following code:


<?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; ?>


And then in theme.php add the following lines under the showFile() function's lists of scripts:


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()));
T
Hi,

Looks good and thanks for sharing. This is something I can definitely add to the plugin feature list :)

Cheers,
  • Page :
  • 1
There are no replies made for this post yet.