Your idea of using the current date in the filename would be the easiest. In the template for your page, you could have the following to generate your current day link:
<a href="/path/to/file/filename_<?php echo date('Y-m-d') ?>.pdf">Today's file</a>
The above uses the PHP date function to create a filename with the current date appended to it in this format:
YYYY-MM-DD
So for today's date, the filename would be:
filename_2011-09-28.pdf
Update: Based on OP's comment, you could do the following:
- Create a shortcode. This would easily allow you to insert the PHP function call in any post you wanted to create the "Today's file" link in.
- In the shortcode, use the PHP hash function to take today's date and generate a hash value.
- You would then need to have the files on the server with an equivalent hash value in their file name for each day.
Shortcode
In your theme's functions.php
file, you would define the following:
// Define the function that the [todays-file] shortcode wil invoke
// Purpose is to return the link with the hashed file name
function todays_file_func($atts) {
// Generate the hash of today's date
$salt = "A random string to make it harder to crack the hash";
$dateHash = hash('md5', date('Y-m-d').$salt);
// Output the link with today's filename
return "<a href='/path/to/filename_".$dateHash.".pdf'>Today's file</a>";
}
add_shortcode( 'todays-file', 'todays_file_func' );
Then you just need to add the shortcode to any post:
[todays-file]