Thumbs on the main page (2 posts)

  1. modelsblog
    Posted 8 years ago #

    I'm using the magadine but this problem happens to be with many themes of that kind.
    I'd like to have a main page with several excerpts and the related thumbnail to every excerpt.
    Just like [thumbnail] excerpt , read more. I've tried to edit the excerpt-code within the pages and the index with this code

    <a href="<?php the_permalink() ?>">
                    <?php echo wp_get_attachment_image($first_attachment->ID); ?>
            <?php the_excerpt() ?>

    but I still can't get a thumbnail next to the excerpt. Is there any chance to fix this problem?
    Shouldn't <?php the_excerpt(__('Readmore ยป'));?> automatically show a thumbnail?
    I'm a bit confused.

    Thank you in advance,

  2. educationthemes
    Posted 8 years ago #

    I think what you want to do is to dislay a thumbnail next to the excerpt right?

    If so then you could use the custom field in order to do this. In the correct place in your template file you could use this code which will call a URL from the custom field with the key "thumbnail" and then display that image.

    `<img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="<?php the_title(); ?> Image" />

    A little styling and you are good to go.

Topic Closed

This topic has been closed to new replies.

About this Topic