-
trashwireParticipant
First off, I LOVE the theme! I’m using it on trashwire.com and it looks great.
I was just wondering if there’s a way to make the featured image a link to the post so people could click on the image in addition to the headline or “read more” link. Is it possible to drop in some code on the home.php file (or somewhere else) to make the images link to the full post?
Thanks for such a great theme!
Daniel TaraKeymasterSure there is.
In functions.php, replace the line:
the_post_thumbnail(array($width,$height), array('alt' => $title));
with:
<a" href="<?php the_permalink(); ?>">the_post_thumbnail(array($width,$height), array('alt' => $title));</a">
trashwireParticipantThanks for such a quick response!
I tried inserting that code, but it gave me this message:
Parse error: syntax error, unexpected ‘<‘ infunctions.php on line 219I copied and pasted the code from your post, so I think it is correct, but then when I click save changes, it gives me that error.
Is there something else I should try?
Daniel TaraKeymasterI think the correct code is this:
?><a" href="<?php the_permalink(); ?>">the_post_thumbnail(array($width,$height), array('alt' => $title));</a"><?php
It also has a typo, remove the ” after the <a
trashwireParticipantHey Daniel,
Sorry to keep asking, but it still doesn’t seem to be working. I’m sure I’m probably entering something wrong, but I can’t figure out what.
I’m talking this:
[code]
if ( function_exists( ‘has_post_thumbnail’ ) && has_post_thumbnail() )
{
$title = get_the_title();
the_post_thumbnail(array($width,$height), array(‘alt’ => $title));
}
[/code]and replacing
[code]the_post_thumbnail(array($width,$height), array(‘alt’ => $title));[/code]
with
[code]?><a” href=”<?php the_permalink(); ?>”>the_post_thumbnail(array($width,$height), array(‘alt’ => $title));</a”><?php
[/code]But it gives me an error message saying [quote]”Parse error: syntax error, unexpected ‘<‘ in /home/trashwir/public_html/wp-content/themes/cover-wp/functions.php on line 219″[/quote]
I also tried removing the ” after the first <a, but that didn’t work either.
Can you explain what I’m doing wrong?
Thanks!
[b]UPDATE[/b]
I think I figured it out. It looks like this makes it work.
[code]
?><a” href=”<?php the_permalink(); ?>”><?php the_post_thumbnail(array($width,$height), array(‘alt’ => $title));?><?php[/code]maurizio04Participant@trashwire
Could you post the color modification you did on your site, nice work πtrashwireParticipant@maurizio04
Thanks so much!To change the colors, I replaced the images (the png files) with ones that fit my desired color scheme. Then I added the code for those colors into the mystyle.css file. The colors for the sections aren’t controlled by hex codes alone, there are images that have the gradient at the top, so you have to match the code with the color at the bottom of those png files. Does that make any sense?
maurizio04Participantyes, and making the gradient files is complicated for anyone that do not use frequently Photoshop…..
oro77ParticipantSorry to up an old post but I did not manage to make the link to the post through the feature post image.
I have changed the functions.php (line 219)
[code]
?><a” href=”<?php the_permalink(); ?>”><?php the_post_thumbnail(array($width,$height), array(‘alt’ => $title));?><?php
[/code]I did not have syntax problem but my feature image is still not linked. Did I misunderstand something ?
Thank you in advance.
oro77ParticipantSorry for my previous post.
I got it right :?>“><?php the_post_thumbnail(array($width,$height), array(‘alt’ => $title));?><?php
gdaniels99ParticipantI’m using version 1.6.6 and have tried every single solution in this thread and none of them solve the problem…the thumbnail image is still not clickable. And some of the solutions crashed my site. So how about just adding this functionality to a future update of the theme?
miz.micheleParticipantIt drives me crazy when people get answers and won’t share them so hopefully this will help someone. I’ve tried to post the code that works but for some reason it is not posting property so I put it in a paste bin that you can find here http://pastebin.com/sBDpRxfE
If you replace line 219 with this line, the images will link to your posts.
- This reply was modified 12 years, 3 months ago by miz.michele.
miz.micheleParticipantdelete this entry
- This reply was modified 12 years, 3 months ago by miz.michele.
- This reply was modified 12 years, 3 months ago by miz.michele.
miz.micheleParticipantDaniel I am soooooooooooo frustrated. Putting in the above code that I put in the pastebin does make the photos link however my entire excerpts- all of them are underlined are a permalink as well.
I’ve look at few other sites that are using your theme that got their featured images linking and they don’t have the giant permalink for the excerpts.
Any ideas?
Tagged: linked, summary text, thumbnails
You must be logged in to reply to this topic.