WordPress.org

Ready to get started?Download WordPress

Forums

Using the Loop to Display Posts (IMG/PERMALINK) (7 posts)

  1. zOmbiesundaYs
    Member
    Posted 5 years ago #

    I've been trying to utilize a plugin to display the contents of my categories with a thumbnail and permalink below it.

    I've gotten to a point where I can use the Loop to draw permalinks, but how can I call images? Would I have to use custom fields? I read around about images through custom fields, but either I'm misunderstanding it or it's not what I need.

    Any help would be most appreciated, this has been a simplistic project turned month+ project.

  2. pandusetiawan
    Member
    Posted 5 years ago #

    what images do you mean?the avatar or just an image that you upload into your server?

  3. zOmbiesundaYs
    Member
    Posted 5 years ago #

    Here's what I've got so far (doesn't display, so something's wrong)

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      <div class="post">
               <?php the_thumb(); ?>
               <br />
    			<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
               <br />
    		    <small><?php the_time('F, Y'); ?></small>
       </div>
      <!--post #end -->
             <?php endwhile; ?>

    That bit "the_thumb()" is Alakhar's Post Revisited. I upload an image for each post in each category. I want the category view to show the thumbnail, permalink below that, and then the date below that of the post.

    Thanks!

  4. zOmbiesundaYs
    Member
    Posted 5 years ago #

    I was able to figure the loop out (at long last!)

    However I'm now just having difficulties with formatting. I need to format the following output into rows of 4 columned:

    `<?php } else { ?>
    <div class="post">
    <?php } ?>
    <!-- Display the Title as a link to the Post's permalink. -->

    </h2>

    <div class="post" id="post">
    <?php the_thumb(); ?>
    <h2>">
    <?php the_title(); ?>
    </h2>
    <!-- Display the Time. -->
    <small>
    <?php the_time('F jS, Y'); ?>
    </small></div>
    <!-- Stop The Loop (but note the "else:" - see next line). -->
    <?php endwhile; else: ?>`

    I understand I can just throw a div tag on it, but what kind of css would allow me to format the pictures and text appropriatly?

    Thanks!

  5. pandusetiawan
    Member
    Posted 5 years ago #

    where exactly you put that code?

  6. zOmbiesundaYs
    Member
    Posted 5 years ago #

    That code is in my category-# (# of category) to force a custom template for it.

    Included in it is WordPress' info-tags, made it easier for me to figure this thing out.

  7. zOmbiesundaYs
    Member
    Posted 5 years ago #

    My posts coming in are oddly misaligned. I'm not sure if it's the Post Thumbs Revisited plugin, varied sized thumbnails, my poor CSS, or what but each of my thumbnails in the first row descend instead of sit across.

    Is there a CSS tag I can use to align them, or is there something I'm doin wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic