Forums

Thumbnails on frontpage (2 posts)

  1. pimpdaddy.dk
    Member
    Posted 3 years ago #

    Hi,

    I would like all articles on the front page to have a thumbnail picture on the front page, and a regular size picture when you see the full post. Like on this page: http://www.gate303.net/

    I have found an article that describes how to do that: http://www.gate303.net/2007/09/25/wordpress-custom-fields-guide/

    But i have no idea where i should put that code:

    <?php if(get_post_meta($post->ID, "thumbnail", true)) {
    $size = getimagesize($_SERVER["DOCUMENT_ROOT"].get_post_meta($post->ID, "thumbnail", true)); ?>
    <img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="" width="<?php echo $size[0]; ?>" height="<?php echo $size[1]; ?>" />
    <?php } ?>

    I guess it should go somewhere in a .php file in my theme. But where?
    Can someone please guide me a little bit?

    Thanks.

    /Martin

  2. mrwangkai
    Member
    Posted 3 years ago #

    you can try placing it in the loop of index.php
    this is what I did with mine on CareAce

    <?php $image = get_post_meta($post->ID, 'thumb', true);
    $image = ( !empty($image) ) ? $image : 	'http://www.careace.net/images/12345.png/'; ?> 
    
    <a href="<?php the_permalink() ?>"><img class="thumb" src="<?php echo $image; ?>" alt="CareAce" width="140px" /></a>

Topic Closed

This topic has been closed to new replies.

About this Topic