Stupid WP
- Started
- Last post
- 9 Responses
- Centigrade
Ok so I google this and couldn't find a clear and easy way. Anyone here know how to do this.
I want to have a thumbnail on the index page of a wordpress that will be different from the actual post image. Any ideas?
- landock0
I'm sure there's an easier way but you might have to write your own functions to do it. Look at the documentation:
This shit get's the url of a particular image:
http://codex.wordpress.org/Funct…This get's the url of a thumbnail:
http://codex.wordpress.org/Funct…
- Centigrade0
Damn it!
That looks complicated.
- noob123450
The way I did it was thought custom fields.
http://codex.wordpress.org/Custo…I created a custom field called "thumbnail" and pasted the URL of the thumbnail image into the value box.
Here's the code to echo back the image=
<?php $thumb = get_post_meta($post->ID, 'thumbnail', $single = true); ?>
<?php // if there's a thumbnail
if($thumb !== '') { ?>
<p>
<img src="<?php echo $thumb; ?>" height="200" width="333" />
</p>
<?php } // end if statement// if there's not a thumbnail
else { echo ''; }
?>
- noob123450
Here's my URL for reference-
http://www.ilikesoda.us/- this is good! And exactly what I'm trying to achieve.Centigrade
- taxiguerrilla0
Search for wp_post_thumbnail plugin.
- Centigrade0
The plugin looks good. Do you still end up with the full uncropped image in the post? There's no live demo on the plugin site.
- acescence0
wp post thumbnail is broken in the current wp version, so not sure that'll work out for you. my vote would be to keep it simple and use a custom field like noob said above.
- Centigrade0
Coolio. Still learning WP... so where exactly to I paste the php code. In the index.php? Inside the "loop"?
- noob123450
Definitely inside the loop. I say just experiment a little to get a feel for where's showing up. I have the thumb before the title and link, then I pushed up the title and link with a negative margin-top. Looks like its all one piece but it generate dynamically and is a little more SEO friendly.
- thanks! Will be experimenting later when I get home.Centigrade