Hi karpediem,
Try removing the trailing slash from your new directory path in the filter. Change 'uploads/download/' to 'uploads/download'. Like this:
function change_download_files_directory() {
return 'uploads/download';
}
add_filter( 'fds_download_files_directory', 'change_download_files_directory' );
The first of your three examples is the only correct way. You can’t specify a relative path in the shortcode, it has to be the full URL like the first one:
// Correct format
[download label="logo (.ai)"]http://rainbowflash.org/uploads/download/rbw_logo.ai[/download]
// Incorrect format (relative path not supported)
[download label="logo (.ai)"]rbw_logo.ai[/download]
// Incorrect format (relative path not supported)
[download label="logo (.ai)"]/rbw_logo.ai[/download]
Also:
Since you’re supplying download links for an unsupported file extension (ai), you may need to modify the mime types list in /wp-content/force-download.php/ if files still aren’t downloading correctly.
Not quite sure what the correct mime type is for Adobe Illustrator files, a quick Google search suggested 'application/illustrator', or 'application/pdf'.
You’d want to open /wp-content/force-download.php/, and find this line:
case "jpg": $ctype="image/jpg"; break;
paste this on the next line:
case "ai": $ctype="application/illustrator"; break;
Hi and thank you for having answered very fast !
I made the modifications which you indicated me :
– functions.php => return ‘uploads/download’;
– /wp-content/force-download.php/ => add case “ai”: $ctype=”application/illustrator”; break;
– shortcode => [download label=”logo (.ai)”]http://rainbowflash.org/uploads/download/rbw_logo.ai[/download]
Unfortunately it does not work. It display :
<a href="http://rainbowflash.org/download/http://rainbowflash.org/uploads/download/rbw_logo.ai" class="" rel="none">logo (.ai)</a>
I do something wrong ?
Thank you
You’ve left /wp-content/ out of your file’s URL. So:
[download label="logo (.ai)"]http://rainbowflash.org/wp-content/uploads/download/rbw_logo.ai[/download]
If you still get a 404, I suggest visiting Settings > Permalinks to flush your rewrite rules.
Hi,
The shortcode :
[download label="logo (.ai)"]http://rainbowflash.org/wp-content/uploads/download/rbw_logo.ai[/download]
display
<a href="http://rainbowflash.org/download/rbw_logo.ai" >logo (.ai)</a>
In Settings > Permalinks, I have :
Post name : http://rainbowflash.org/blog/sample-post/
I save (is it an other way to flush my rewrite rules ?).
It’s the same issue…
Now, if I put directly this link in my post :
<a href="http://rainbowflash.org/wp-content/force-download.php?file=uploads/download/rbw_logo.ai">Download : logo Rainbowflash (.ai)</a>
The file is right download…
An other idea please ?
Hmm. Using your rbw_logo.ai file, your filter to modify the supported directory and your permalink settings, it’s working fine for me.
One thing that has me a little perturbed is that you said this shortcode:
[download label="logo (.ai)"]http://rainbowflash.org/wp-content/uploads/download/rbw_logo.ai[/download]
Outputs this URL in the link:
http://rainbowflash.org/download/rbw_logo.ai
But based on the plugin default rewrite scheme, it should actually output the link URL as this (as it did in my tests):
http://rainbowflash.org/download/download/rbw_logo.ai
Have you by chance modified the path supplied to the fds_download_rewrite_path filter and not mentioned it?
No, I made nothing of other one, just to declare in functions.php the already specified code
function change_download_files_directory() {
return 'uploads/download';
}
add_filter( 'fds_download_files_directory', 'change_download_files_directory' );
OK. Well, again, using a path of ‘uploads/download’, the plugin will output the path as rainbowflash.org/download/download/filename.ext.
Do you have a live URL with a download shortcode link on it that I can test?
It’s also possible there is a conflict with another plugin or even your theme. Have you tried deactivating all other plugins to see if that will resolve it?
Closing as resolved. Feel free to re-open or start a new thread if you have more issues.