Trying to extract “postname”
I’m doing the following bit of trickery to allow for a file download of the same name as the post title:
<a href="/files/<?php the_title(); ?>.zip">Download <?php the_title(); ?></a>
The obvious problem is that it inserts a %20 where spaces are. I would prefer to have the filename match the %postname%, that is “post-title” becomes “post-title.zip”. However, there’s no “the_postname”, and ‘the_permalink’ gives me, well, the whole link. I’ve looked through the codex, and nothing seems to do it.
- The topic ‘Trying to extract “postname”’ is closed to new replies.