Need help creating a unordered list image thumbnail that permalinks to article (3 posts)

  1. foojae
    Posted 7 years ago #

    I'm having trouble setting up a unordered list thumbnail img link to article that once the reader clicks on a thumbnail, will take the reader to the full permalink article.

    For example

    <div id="articles">
    	<ul id="thumbnails">
    <?php while (have_posts()) : the_post(); ?>
    	<li><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title(); ?>"><img src="<?php the_content(); ?>"  alt="<?php the_title(); ?>"</a></li>
    <?php endwhile; ?>
    <?php else : ?>

    And under the write tab (inside WP dashboard), I want to add an article related image to the post, (so that the thumbnail will show on the index page) followed by related content after. With other CMS, I was able to achieve this using custom field tags. The thumbnail only displays itself on the index page, no excerpts or contents are shown on the index.

    How can achieve this? Thanks in advance.

  2. Kafkaesqui

    Posted 7 years ago #

    the_content() will output all content of a post, but even if the content was just the url to an image, it would still include any formatting WordPress imposes on it.

    Anyway, I describe a few ways to accomplish what you're after here:


  3. foojae
    Posted 7 years ago #

    Kafkaesqui, thank you so much. It worked brilliantly.

Topic Closed

This topic has been closed to new replies.

About this Topic