Post Thumbnail Link
-
Hi all,
Further to an earlier question, which I a managed to solve myself, I would appreciate any input into the following:
I want to generate a list of thumbnail links to posts within a given category. I have figured out a way of doing this – in my category.php file I have the following:
<a href="<?php the_permalink() ?>"><img src="../wp-content/images/<?php the_title() ?>.jpg" width="107" height="75" border="0"></a>
As you can see I am using “the_title” as a means to generating what I want. All I have to do is to ensure that I upload a jpg that has the same name as the post title.
However, my only concern here is if the post title is more than one word. This would mean a space, or spaces, in the file name of the jpg and I know that servers are not ‘overly keen’ on file names with spaces!
I understand that I could use “the_ID” instead of the title, but since I have to allow my client to manage this in the future I think it will be difficult trying to explain that they need to find the ID number of the post before uploading the jpg file.
If anyone can think of any way around this I would be extremely grateful.
Cheers.
- The topic ‘Post Thumbnail Link’ is closed to new replies.